Fix order/list assumptions in population tests
Python3 and random hash seeds will fail some of these tests because of changes to views and key ordering.
This commit is contained in:
@@ -37,7 +37,7 @@ class TestPopulationMemoryBased():
|
|||||||
self.population.add_information_about_person(session_info)
|
self.population.add_information_about_person(session_info)
|
||||||
|
|
||||||
issuers = self.population.issuers_of_info(nid)
|
issuers = self.population.issuers_of_info(nid)
|
||||||
assert issuers == [IDP_ONE]
|
assert list(issuers) == [IDP_ONE]
|
||||||
subjects = [code(c) for c in self.population.subjects()]
|
subjects = [code(c) for c in self.population.subjects()]
|
||||||
assert subjects == [cnid]
|
assert subjects == [cnid]
|
||||||
# Are any of the sources gone stale
|
# Are any of the sources gone stale
|
||||||
@@ -55,7 +55,8 @@ class TestPopulationMemoryBased():
|
|||||||
'surName': 'Andersson'}
|
'surName': 'Andersson'}
|
||||||
|
|
||||||
info = self.population.get_info_from(nid, IDP_ONE)
|
info = self.population.get_info_from(nid, IDP_ONE)
|
||||||
assert info.keys() == ["not_on_or_after", "name_id", "ava"]
|
assert sorted(list(info.keys())) == sorted(["not_on_or_after",
|
||||||
|
"name_id", "ava"])
|
||||||
assert info["name_id"] == nid
|
assert info["name_id"] == nid
|
||||||
assert info["ava"] == {'mail': 'anders.andersson@example.com',
|
assert info["ava"] == {'mail': 'anders.andersson@example.com',
|
||||||
'givenName': 'Anders',
|
'givenName': 'Anders',
|
||||||
@@ -93,7 +94,8 @@ class TestPopulationMemoryBased():
|
|||||||
"eduPersonEntitlement": "Anka"}
|
"eduPersonEntitlement": "Anka"}
|
||||||
|
|
||||||
info = self.population.get_info_from(nid, IDP_OTHER)
|
info = self.population.get_info_from(nid, IDP_OTHER)
|
||||||
assert info.keys() == ["not_on_or_after", "name_id", "ava"]
|
assert sorted(list(info.keys())) == sorted(["not_on_or_after",
|
||||||
|
"name_id", "ava"])
|
||||||
assert info["name_id"] == nid
|
assert info["name_id"] == nid
|
||||||
assert info["ava"] == {"eduPersonEntitlement": "Anka"}
|
assert info["ava"] == {"eduPersonEntitlement": "Anka"}
|
||||||
|
|
||||||
@@ -111,7 +113,7 @@ class TestPopulationMemoryBased():
|
|||||||
self.population.add_information_about_person(session_info)
|
self.population.add_information_about_person(session_info)
|
||||||
|
|
||||||
issuers = self.population.issuers_of_info(nida)
|
issuers = self.population.issuers_of_info(nida)
|
||||||
assert issuers == [IDP_ONE]
|
assert list(issuers) == [IDP_ONE]
|
||||||
subjects = [code(c) for c in self.population.subjects()]
|
subjects = [code(c) for c in self.population.subjects()]
|
||||||
assert _eq(subjects, [cnid, cnida])
|
assert _eq(subjects, [cnid, cnida])
|
||||||
|
|
||||||
@@ -130,7 +132,8 @@ class TestPopulationMemoryBased():
|
|||||||
}
|
}
|
||||||
|
|
||||||
info = self.population.get_info_from(nida, IDP_ONE)
|
info = self.population.get_info_from(nida, IDP_ONE)
|
||||||
assert info.keys() == ["not_on_or_after", "name_id", "ava"]
|
assert sorted(list(info.keys())) == sorted(["not_on_or_after",
|
||||||
|
"name_id", "ava"])
|
||||||
assert info["name_id"] == nida
|
assert info["name_id"] == nida
|
||||||
assert info["ava"] == {"givenName": "Bertil",
|
assert info["ava"] == {"givenName": "Bertil",
|
||||||
"surName": "Bertilsson",
|
"surName": "Bertilsson",
|
||||||
@@ -170,6 +173,7 @@ class TestPopulationMemoryBased():
|
|||||||
"eduPersonEntitlement": "Anka"}
|
"eduPersonEntitlement": "Anka"}
|
||||||
|
|
||||||
info = self.population.get_info_from(nid, IDP_OTHER)
|
info = self.population.get_info_from(nid, IDP_OTHER)
|
||||||
assert list(info.keys()) == ["not_on_or_after", "name_id", "ava"]
|
assert sorted(list(info.keys())) == sorted(["not_on_or_after",
|
||||||
|
"name_id", "ava"])
|
||||||
assert info["name_id"] == nid
|
assert info["name_id"] == nid
|
||||||
assert info["ava"] == {"eduPersonEntitlement": "Anka"}
|
assert info["ava"] == {"eduPersonEntitlement": "Anka"}
|
||||||
|
|||||||
Reference in New Issue
Block a user