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:
Clint Byrum
2015-05-24 10:14:16 -07:00
parent fb17c4f702
commit 35f1939302

View File

@@ -37,7 +37,7 @@ class TestPopulationMemoryBased():
self.population.add_information_about_person(session_info)
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()]
assert subjects == [cnid]
# Are any of the sources gone stale
@@ -55,7 +55,8 @@ class TestPopulationMemoryBased():
'surName': 'Andersson'}
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["ava"] == {'mail': 'anders.andersson@example.com',
'givenName': 'Anders',
@@ -93,7 +94,8 @@ class TestPopulationMemoryBased():
"eduPersonEntitlement": "Anka"}
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["ava"] == {"eduPersonEntitlement": "Anka"}
@@ -111,7 +113,7 @@ class TestPopulationMemoryBased():
self.population.add_information_about_person(session_info)
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()]
assert _eq(subjects, [cnid, cnida])
@@ -130,7 +132,8 @@ class TestPopulationMemoryBased():
}
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["ava"] == {"givenName": "Bertil",
"surName": "Bertilsson",
@@ -170,6 +173,7 @@ class TestPopulationMemoryBased():
"eduPersonEntitlement": "Anka"}
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["ava"] == {"eduPersonEntitlement": "Anka"}