Merge branch 'grahamu-fix-import-all' into v0.3.x
This commit is contained in:
commit
fc39296610
11 changed files with 103 additions and 35 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
from datetime import timedelta
|
||||||
import logging
|
import logging
|
||||||
try:
|
try:
|
||||||
from urllib import urlencode
|
from urllib import urlencode
|
||||||
|
@ -8,10 +9,22 @@ except ImportError:
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
|
|
||||||
from oidc_provider.lib.claims import StandardScopeClaims
|
from oidc_provider.lib.claims import StandardScopeClaims
|
||||||
from oidc_provider.lib.errors import *
|
from oidc_provider.lib.errors import (
|
||||||
from oidc_provider.lib.utils.params import *
|
AuthorizeError,
|
||||||
from oidc_provider.lib.utils.token import *
|
ClientIdError,
|
||||||
from oidc_provider.models import *
|
RedirectUriError,
|
||||||
|
)
|
||||||
|
from oidc_provider.lib.utils.params import Params
|
||||||
|
from oidc_provider.lib.utils.token import (
|
||||||
|
create_code,
|
||||||
|
create_id_token,
|
||||||
|
create_token,
|
||||||
|
encode_id_token,
|
||||||
|
)
|
||||||
|
from oidc_provider.models import (
|
||||||
|
Client,
|
||||||
|
UserConsent,
|
||||||
|
)
|
||||||
from oidc_provider import settings
|
from oidc_provider import settings
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -9,10 +9,20 @@ except ImportError:
|
||||||
|
|
||||||
from django.http import JsonResponse
|
from django.http import JsonResponse
|
||||||
|
|
||||||
from oidc_provider.lib.errors import *
|
from oidc_provider.lib.errors import (
|
||||||
from oidc_provider.lib.utils.params import *
|
TokenError,
|
||||||
from oidc_provider.lib.utils.token import *
|
)
|
||||||
from oidc_provider.models import *
|
from oidc_provider.lib.utils.params import Params
|
||||||
|
from oidc_provider.lib.utils.token import (
|
||||||
|
create_id_token,
|
||||||
|
create_token,
|
||||||
|
encode_id_token,
|
||||||
|
)
|
||||||
|
from oidc_provider.models import (
|
||||||
|
Client,
|
||||||
|
Code,
|
||||||
|
Token,
|
||||||
|
)
|
||||||
from oidc_provider import settings
|
from oidc_provider import settings
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,11 @@ from jwkest.jwk import SYMKey
|
||||||
from jwkest.jws import JWS
|
from jwkest.jws import JWS
|
||||||
|
|
||||||
from oidc_provider.lib.utils.common import get_issuer
|
from oidc_provider.lib.utils.common import get_issuer
|
||||||
from oidc_provider.models import *
|
from oidc_provider.models import (
|
||||||
|
Code,
|
||||||
|
RSAKey,
|
||||||
|
Token,
|
||||||
|
)
|
||||||
from oidc_provider import settings
|
from oidc_provider import settings
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import os
|
|
||||||
import random
|
import random
|
||||||
import string
|
import string
|
||||||
try:
|
try:
|
||||||
|
@ -8,7 +7,10 @@ except ImportError:
|
||||||
|
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
|
|
||||||
from oidc_provider.models import *
|
from oidc_provider.models import (
|
||||||
|
Client,
|
||||||
|
Code,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
FAKE_NONCE = 'cb584e44c43ed6bd0bc2d9c7e242837d'
|
FAKE_NONCE = 'cb584e44c43ed6bd0bc2d9c7e242837d'
|
||||||
|
|
|
@ -16,9 +16,13 @@ from django.test import TestCase
|
||||||
from jwkest.jwt import JWT
|
from jwkest.jwt import JWT
|
||||||
|
|
||||||
from oidc_provider import settings
|
from oidc_provider import settings
|
||||||
from oidc_provider.models import *
|
from oidc_provider.tests.app.utils import (
|
||||||
from oidc_provider.tests.app.utils import *
|
create_fake_user,
|
||||||
from oidc_provider.views import *
|
create_fake_client,
|
||||||
|
FAKE_CODE_CHALLENGE,
|
||||||
|
is_code_valid,
|
||||||
|
)
|
||||||
|
from oidc_provider.views import AuthorizeView
|
||||||
|
|
||||||
|
|
||||||
class AuthorizationCodeFlowTestCase(TestCase):
|
class AuthorizationCodeFlowTestCase(TestCase):
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
from django.core.urlresolvers import reverse
|
from django.core.urlresolvers import reverse
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
|
|
||||||
from oidc_provider.views import *
|
from oidc_provider.tests.app.utils import create_fake_user
|
||||||
from oidc_provider.tests.app.utils import *
|
|
||||||
|
|
||||||
|
|
||||||
class UserInfoTestCase(TestCase):
|
class UserInfoTestCase(TestCase):
|
||||||
|
|
|
@ -2,7 +2,7 @@ from django.core.urlresolvers import reverse
|
||||||
from django.test import RequestFactory
|
from django.test import RequestFactory
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
|
|
||||||
from oidc_provider.views import *
|
from oidc_provider.views import ProviderInfoView
|
||||||
|
|
||||||
|
|
||||||
class ProviderInfoTestCase(TestCase):
|
class ProviderInfoTestCase(TestCase):
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
from datetime import timedelta
|
||||||
|
import json
|
||||||
|
import uuid
|
||||||
|
|
||||||
from base64 import b64encode
|
from base64 import b64encode
|
||||||
try:
|
try:
|
||||||
from urllib.parse import urlencode
|
from urllib.parse import urlencode
|
||||||
|
@ -5,15 +9,30 @@ except ImportError:
|
||||||
from urllib import urlencode
|
from urllib import urlencode
|
||||||
|
|
||||||
from django.core.management import call_command
|
from django.core.management import call_command
|
||||||
|
from django.core.urlresolvers import reverse
|
||||||
from django.test import RequestFactory, override_settings
|
from django.test import RequestFactory, override_settings
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
|
from django.utils import timezone
|
||||||
from jwkest.jwk import KEYS
|
from jwkest.jwk import KEYS
|
||||||
|
from jwkest.jws import JWS
|
||||||
from jwkest.jwt import JWT
|
from jwkest.jwt import JWT
|
||||||
from mock import patch
|
from mock import patch
|
||||||
|
|
||||||
from oidc_provider.lib.utils.token import *
|
from oidc_provider.lib.utils.token import create_code
|
||||||
from oidc_provider.tests.app.utils import *
|
from oidc_provider.models import Token
|
||||||
from oidc_provider.views import *
|
from oidc_provider.tests.app.utils import (
|
||||||
|
create_fake_user,
|
||||||
|
create_fake_client,
|
||||||
|
FAKE_CODE_CHALLENGE,
|
||||||
|
FAKE_CODE_VERIFIER,
|
||||||
|
FAKE_NONCE,
|
||||||
|
FAKE_RANDOM_STRING,
|
||||||
|
)
|
||||||
|
from oidc_provider.views import (
|
||||||
|
JwksView,
|
||||||
|
TokenView,
|
||||||
|
userinfo,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class TokenTestCase(TestCase):
|
class TokenTestCase(TestCase):
|
||||||
|
@ -208,14 +227,14 @@ class TokenTestCase(TestCase):
|
||||||
response = TokenView.as_view()(request)
|
response = TokenView.as_view()(request)
|
||||||
|
|
||||||
self.assertEqual(response.status_code == 405, True,
|
self.assertEqual(response.status_code == 405, True,
|
||||||
msg=request.method+' request does not return a 405 status.')
|
msg=request.method + ' request does not return a 405 status.')
|
||||||
|
|
||||||
request = self.factory.post(url)
|
request = self.factory.post(url)
|
||||||
|
|
||||||
response = TokenView.as_view()(request)
|
response = TokenView.as_view()(request)
|
||||||
|
|
||||||
self.assertEqual(response.status_code == 400, True,
|
self.assertEqual(response.status_code == 400, True,
|
||||||
msg=request.method+' request does not return a 400 status.')
|
msg=request.method + ' request does not return a 400 status.')
|
||||||
|
|
||||||
def test_client_authentication(self):
|
def test_client_authentication(self):
|
||||||
"""
|
"""
|
||||||
|
@ -326,7 +345,7 @@ class TokenTestCase(TestCase):
|
||||||
the JOSE Header.
|
the JOSE Header.
|
||||||
"""
|
"""
|
||||||
SIGKEYS = self._get_keys()
|
SIGKEYS = self._get_keys()
|
||||||
RSAKEYS = [ k for k in SIGKEYS if k.kty == 'RSA' ]
|
RSAKEYS = [k for k in SIGKEYS if k.kty == 'RSA']
|
||||||
|
|
||||||
code = self._create_code()
|
code = self._create_code()
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import json
|
||||||
|
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
try:
|
try:
|
||||||
from urllib.parse import urlencode
|
from urllib.parse import urlencode
|
||||||
|
@ -9,9 +11,15 @@ from django.test import RequestFactory
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
|
|
||||||
from oidc_provider.lib.utils.token import *
|
from oidc_provider.lib.utils.token import (
|
||||||
from oidc_provider.models import *
|
create_id_token,
|
||||||
from oidc_provider.tests.app.utils import *
|
create_token,
|
||||||
|
)
|
||||||
|
from oidc_provider.tests.app.utils import (
|
||||||
|
create_fake_user,
|
||||||
|
create_fake_client,
|
||||||
|
FAKE_NONCE,
|
||||||
|
)
|
||||||
from oidc_provider.views import userinfo
|
from oidc_provider.views import userinfo
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import logging
|
||||||
|
|
||||||
from Crypto.PublicKey import RSA
|
from Crypto.PublicKey import RSA
|
||||||
from django.contrib.auth.views import redirect_to_login, logout
|
from django.contrib.auth.views import redirect_to_login, logout
|
||||||
from django.core.urlresolvers import reverse
|
from django.core.urlresolvers import reverse
|
||||||
|
@ -9,9 +11,14 @@ from django.views.generic import View
|
||||||
from jwkest import long_to_base64
|
from jwkest import long_to_base64
|
||||||
|
|
||||||
from oidc_provider.lib.claims import StandardScopeClaims
|
from oidc_provider.lib.claims import StandardScopeClaims
|
||||||
from oidc_provider.lib.endpoints.authorize import *
|
from oidc_provider.lib.endpoints.authorize import AuthorizeEndpoint
|
||||||
from oidc_provider.lib.endpoints.token import *
|
from oidc_provider.lib.endpoints.token import TokenEndpoint
|
||||||
from oidc_provider.lib.errors import *
|
from oidc_provider.lib.errors import (
|
||||||
|
AuthorizeError,
|
||||||
|
ClientIdError,
|
||||||
|
RedirectUriError,
|
||||||
|
TokenError,
|
||||||
|
)
|
||||||
from oidc_provider.lib.utils.common import redirect, get_site_url, get_issuer
|
from oidc_provider.lib.utils.common import redirect, get_site_url, get_issuer
|
||||||
from oidc_provider.lib.utils.oauth2 import protected_resource_view
|
from oidc_provider.lib.utils.oauth2 import protected_resource_view
|
||||||
from oidc_provider.models import RESPONSE_TYPE_CHOICES, RSAKey
|
from oidc_provider.models import RESPONSE_TYPE_CHOICES, RSAKey
|
||||||
|
|
|
@ -98,10 +98,12 @@ def runtests(*test_args):
|
||||||
try:
|
try:
|
||||||
from django.test.runner import DiscoverRunner
|
from django.test.runner import DiscoverRunner
|
||||||
runner_class = DiscoverRunner
|
runner_class = DiscoverRunner
|
||||||
|
if not test_args:
|
||||||
test_args = ["oidc_provider.tests"]
|
test_args = ["oidc_provider.tests"]
|
||||||
except ImportError:
|
except ImportError:
|
||||||
from django.test.simple import DjangoTestSuiteRunner
|
from django.test.simple import DjangoTestSuiteRunner
|
||||||
runner_class = DjangoTestSuiteRunner
|
runner_class = DjangoTestSuiteRunner
|
||||||
|
if not test_args:
|
||||||
test_args = ["tests"]
|
test_args = ["tests"]
|
||||||
|
|
||||||
failures = runner_class(verbosity=1, interactive=True, failfast=False).run_tests(test_args)
|
failures = runner_class(verbosity=1, interactive=True, failfast=False).run_tests(test_args)
|
||||||
|
|
Loading…
Reference in a new issue