diff --git a/oidc_provider/tests/test_authorize_endpoint.py b/oidc_provider/tests/test_authorize_endpoint.py index 9122235..e661814 100644 --- a/oidc_provider/tests/test_authorize_endpoint.py +++ b/oidc_provider/tests/test_authorize_endpoint.py @@ -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.') diff --git a/oidc_provider/tests/test_provider_info_endpoint.py b/oidc_provider/tests/test_provider_info_endpoint.py new file mode 100644 index 0000000..1b205bc --- /dev/null +++ b/oidc_provider/tests/test_provider_info_endpoint.py @@ -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) \ No newline at end of file