Add provider info test. Add some msg to tests.
This commit is contained in:
parent
2c76393c09
commit
c9c5982c35
|
@ -176,8 +176,10 @@ class AuthorizationCodeFlowTestCase(TestCase):
|
|||
|
||||
# Because user doesn't allow app, SHOULD exists an error parameter
|
||||
# in the query.
|
||||
self.assertEqual('error=' in response['Location'], True)
|
||||
self.assertEqual('access_denied' in response['Location'], True)
|
||||
self.assertEqual('error=' in response['Location'], True,
|
||||
msg='error param is missing.')
|
||||
self.assertEqual('access_denied' in response['Location'], True,
|
||||
msg='access_denied param is missing.')
|
||||
|
||||
# Simulate user authorization.
|
||||
post_data['allow'] = 'Accept' # Should be the value of the button.
|
||||
|
@ -198,8 +200,10 @@ class AuthorizationCodeFlowTestCase(TestCase):
|
|||
is_code_ok = False
|
||||
except:
|
||||
is_code_ok = False
|
||||
self.assertEqual(is_code_ok, True)
|
||||
self.assertEqual(is_code_ok, True,
|
||||
msg='Code returned is invalid.')
|
||||
|
||||
# Check if the state is returned.
|
||||
state = (response['Location'].split('state='))[1].split('&')[0]
|
||||
self.assertEqual(state == self.state, True)
|
||||
self.assertEqual(state == self.state, True,
|
||||
msg='State change or is missing.')
|
||||
|
|
26
oidc_provider/tests/test_provider_info_endpoint.py
Normal file
26
oidc_provider/tests/test_provider_info_endpoint.py
Normal file
|
@ -0,0 +1,26 @@
|
|||
from django.core.urlresolvers import reverse
|
||||
from django.test import RequestFactory
|
||||
from django.test import TestCase
|
||||
|
||||
from oidc_provider.views import *
|
||||
|
||||
|
||||
class ProviderInfoTestCase(TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.factory = RequestFactory()
|
||||
|
||||
def test_response(self):
|
||||
"""
|
||||
See if the endpoint is returning the corresponding
|
||||
server information by checking status, content type, etc.
|
||||
"""
|
||||
url = reverse('oidc_provider:provider_info')
|
||||
|
||||
request = self.factory.get(url)
|
||||
|
||||
response = ProviderInfoView.as_view()(request)
|
||||
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertEqual(response['Content-Type'] == 'application/json', True)
|
||||
self.assertEqual(bool(response.content), True)
|
Loading…
Reference in a new issue