def test_get_nameid_persistent(self): user = User(username='******', email='*****@*****.**') fully_qualified = NameIdBuilder.get_nameid_persistent(user.username, user=user, sp_entityid='sp_entity_id', idp_entityid='idp_entity_id') assert fully_qualified == 'idp_entity_id!sp_entity_id!86bb5037f0bf1a9cc7918296437fd560915c182316f23a3f4db480018eb1c71f' no_sp_idp_ids = NameIdBuilder.get_nameid_persistent(user.username, user=user) assert no_sp_idp_ids == '!!86bb5037f0bf1a9cc7918296437fd560915c182316f23a3f4db480018eb1c71f'
def test_get_nameid_persistent(self, sp_metadata_xml): user = User.objects.create(username='******', email='*****@*****.**') sp1 = ServiceProvider.objects.create(entity_id='sp_entity_id_1', local_metadata=sp_metadata_xml) sp2 = ServiceProvider.objects.create(entity_id='sp_entity_id_2', local_metadata=sp_metadata_xml) nameid_1 = NameIdBuilder.get_nameid_persistent(user.username, user=user, sp=sp1) nameid_2 = NameIdBuilder.get_nameid_persistent(user.username, user=user, sp=sp2) assert nameid_1 != nameid_2 try: UUID(nameid_1, version=4) UUID(nameid_2, version=4) except ValueError: assert False