~ubuntuone-pqm-team/django-openid-auth/trunk

« back to all changes in this revision

Viewing changes to django_openid_auth/tests/test_auth.py

  • Committer: Ubuntu One Auto Copilot
  • Author(s): Ricardo Kirkner
  • Date: 2017-04-03 12:37:42 UTC
  • mfrom: (127.1.6 trunk)
  • Revision ID: otto-copilot@canonical.com-20170403123742-slpmglccjzoaejhk
support python 2.7 and 3.5

Merged from https://code.launchpad.net/~ricardokirkner/django-openid-auth/py35-support/+merge/321603

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
from __future__ import unicode_literals
30
30
 
31
31
import re
32
 
from urlparse import urljoin
 
32
try:
 
33
    from urllib.parse import urljoin
 
34
except ImportError:
 
35
    from urlparse import urljoin
33
36
 
34
37
from django.conf import settings
35
38
from django.contrib.auth.models import Group, Permission, User
36
39
from django.core.exceptions import ImproperlyConfigured
37
 
from django.db import models
38
40
from django.test import TestCase
39
41
from django.test.utils import override_settings
40
 
from mock import patch
41
42
from openid.consumer.consumer import (
42
43
    CancelResponse,
43
44
    FailureResponse,
160
161
        perm_label = '%s.%s' % (permission.content_type.app_label,
161
162
                                permission.codename)
162
163
        # Always invalidate the per-request perm cache
163
 
        for attr in user.__dict__.keys():
 
164
        attrs = list(user.__dict__.keys())
 
165
        for attr in attrs:
164
166
            if attr.endswith('_perm_cache'):
165
167
                delattr(user, attr)
166
168