Skip to content

Commit 35f1939

Browse files
committed
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.
1 parent fb17c4f commit 35f1939

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

tests/test_34_population.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def test_add_person(self):
3737
self.population.add_information_about_person(session_info)
3838

3939
issuers = self.population.issuers_of_info(nid)
40-
assert issuers == [IDP_ONE]
40+
assert list(issuers) == [IDP_ONE]
4141
subjects = [code(c) for c in self.population.subjects()]
4242
assert subjects == [cnid]
4343
# Are any of the sources gone stale
@@ -55,7 +55,8 @@ def test_add_person(self):
5555
'surName': 'Andersson'}
5656

5757
info = self.population.get_info_from(nid, IDP_ONE)
58-
assert info.keys() == ["not_on_or_after", "name_id", "ava"]
58+
assert sorted(list(info.keys())) == sorted(["not_on_or_after",
59+
"name_id", "ava"])
5960
assert info["name_id"] == nid
6061
assert info["ava"] == {'mail': '[email protected]',
6162
'givenName': 'Anders',
@@ -93,7 +94,8 @@ def test_extend_person(self):
9394
"eduPersonEntitlement": "Anka"}
9495

9596
info = self.population.get_info_from(nid, IDP_OTHER)
96-
assert info.keys() == ["not_on_or_after", "name_id", "ava"]
97+
assert sorted(list(info.keys())) == sorted(["not_on_or_after",
98+
"name_id", "ava"])
9799
assert info["name_id"] == nid
98100
assert info["ava"] == {"eduPersonEntitlement": "Anka"}
99101

@@ -111,7 +113,7 @@ def test_add_another_person(self):
111113
self.population.add_information_about_person(session_info)
112114

113115
issuers = self.population.issuers_of_info(nida)
114-
assert issuers == [IDP_ONE]
116+
assert list(issuers) == [IDP_ONE]
115117
subjects = [code(c) for c in self.population.subjects()]
116118
assert _eq(subjects, [cnid, cnida])
117119

@@ -130,7 +132,8 @@ def test_add_another_person(self):
130132
}
131133

132134
info = self.population.get_info_from(nida, IDP_ONE)
133-
assert info.keys() == ["not_on_or_after", "name_id", "ava"]
135+
assert sorted(list(info.keys())) == sorted(["not_on_or_after",
136+
"name_id", "ava"])
134137
assert info["name_id"] == nida
135138
assert info["ava"] == {"givenName": "Bertil",
136139
"surName": "Bertilsson",
@@ -170,6 +173,7 @@ def test_modify_person(self):
170173
"eduPersonEntitlement": "Anka"}
171174

172175
info = self.population.get_info_from(nid, IDP_OTHER)
173-
assert list(info.keys()) == ["not_on_or_after", "name_id", "ava"]
176+
assert sorted(list(info.keys())) == sorted(["not_on_or_after",
177+
"name_id", "ava"])
174178
assert info["name_id"] == nid
175179
assert info["ava"] == {"eduPersonEntitlement": "Anka"}

0 commit comments

Comments
 (0)