2018-02-01 17:00:57 +00:00
|
|
|
try:
|
|
|
|
from django.urls import reverse
|
|
|
|
except ImportError:
|
|
|
|
from django.core.urlresolvers import reverse
|
2015-03-06 15:56:35 +00:00
|
|
|
from django.test import RequestFactory
|
|
|
|
from django.test import TestCase
|
|
|
|
|
2016-08-11 22:05:13 +00:00
|
|
|
from oidc_provider.views import ProviderInfoView
|
2015-03-06 15:56:35 +00:00
|
|
|
|
|
|
|
|
|
|
|
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.
|
|
|
|
"""
|
2016-11-01 15:15:48 +00:00
|
|
|
url = reverse('oidc_provider:provider-info')
|
2015-03-06 15:56:35 +00:00
|
|
|
|
|
|
|
request = self.factory.get(url)
|
|
|
|
|
|
|
|
response = ProviderInfoView.as_view()(request)
|
|
|
|
|
|
|
|
self.assertEqual(response.status_code, 200)
|
|
|
|
self.assertEqual(response['Content-Type'] == 'application/json', True)
|
2016-08-11 22:05:13 +00:00
|
|
|
self.assertEqual(bool(response.content), True)
|