tests added
This commit is contained in:
parent
41adf8c22e
commit
67092eb4f4
|
@ -0,0 +1 @@
|
|||
[{"pk": 2, "model": "authentic2.deleteduser", "fields": {"creation": "2014-09-11T01:11:24.405", "user": 1}}]
|
|
@ -0,0 +1 @@
|
|||
[{"pk": 1, "model": "saml.libertyproviderpolicy", "fields": {"name": "Default", "authn_request_signature_check_hint": 0}}, {"pk": 2, "model": "saml.libertyproviderpolicy", "fields": {"name": "Shibboleth SP", "authn_request_signature_check_hint": 2}}, {"pk": 1, "model": "saml.libertyfederation", "fields": {"creation": "2014-10-03T11:54:25.931", "last_modification": "2014-10-03T12:11:26.686", "name_id_sp_name_qualifier": "", "termination_notified": false, "sp": null, "idp": null, "name_id_qualifier": "", "user": 1, "name_id_content": "_05D1286DA257FB1326C12107576D628B", "name_id_format": ""}}, {"pk": 2, "model": "saml.libertyfederation", "fields": {"creation": "2014-10-03T12:11:10.040", "last_modification": "2014-10-03T12:11:10.040", "name_id_sp_name_qualifier": "", "termination_notified": false, "sp": null, "idp": null, "name_id_qualifier": "", "user": 2, "name_id_content": "_E191B750CC87587E6E2ED2130262C4F2", "name_id_format": ""}}]
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,32 @@
|
|||
import json
|
||||
|
||||
from django.test import TestCase, Client
|
||||
from django.core.urlresolvers import reverse
|
||||
|
||||
class UserInfoTest(TestCase):
|
||||
|
||||
fixtures = ('users.json', 'federations.json', 'deleted_users.json')
|
||||
|
||||
def setUp(self):
|
||||
self.client = Client()
|
||||
|
||||
def test_existing_user(self):
|
||||
response = self.client.get(reverse('authentic2-userinfo',
|
||||
kwargs={'nameid':'_E191B750CC87587E6E2ED2130262C4F2'}))
|
||||
self.assertEqual(response.status_code, 200)
|
||||
try:
|
||||
data = json.loads(response.json)
|
||||
except:
|
||||
self.fail('response not a json')
|
||||
|
||||
self.assertEqual(data['email'], 'admin@entrouvert.com')
|
||||
|
||||
def test_deleted_user(self):
|
||||
response = self.client.get(reverse('authentic2-userinfo',
|
||||
kwargs={'nameid':'_05D1286DA257FB1326C12107576D628B'}))
|
||||
self.assertEqual(response.status_code, 404)
|
||||
|
||||
def test_nonexisting_user(self):
|
||||
response = self.client.get(reverse('authentic2-userinfo',
|
||||
kwargs={'nameid':'_05D12DFGZVA257FB1326C12107576D628B'}))
|
||||
self.assertEqual(response.status_code, 404)
|
Reference in New Issue