Skip to content

Commit 8a7caf4

Browse files
committed
test(graphql): [#65186] add itsystem validity parametrization to test_itsystem_roles_validities
This commit adds parametrization to the `test_itsystem_roles_validities` test to ensure that the role UUIDs can be fetched irrespective of the itsystem validity or the role validity.
1 parent 4eb8369 commit 8a7caf4

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

backend/tests/graphapi/test_itsystem_roles.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,20 +195,38 @@ def test_itsystem_roles(
195195
(datetime(2970, 1, 1), datetime(3000, 1, 1)),
196196
],
197197
)
198+
@pytest.mark.parametrize(
199+
"itsystem_start,itsystem_end",
200+
[
201+
# Past
202+
(datetime(1970, 1, 1), datetime(1980, 1, 1)),
203+
# Current
204+
(datetime(1970, 1, 1), None),
205+
(datetime(1970, 1, 1), datetime(3000, 1, 1)),
206+
# Future
207+
(datetime(2970, 1, 1), None),
208+
(datetime(2970, 1, 1), datetime(3000, 1, 1)),
209+
],
210+
)
198211
def test_itsystem_roles_validities(
199212
read_facet_uuid: Callable[[str], UUID],
200213
read_itsystem: Callable[[UUID], dict[str, Any]],
201214
create_class: Callable[[dict[str, Any]], UUID],
202215
create_itsystem: Callable[[dict[str, Any]], UUID],
203216
class_start: datetime,
204217
class_end: datetime | None,
218+
itsystem_start: datetime,
219+
itsystem_end: datetime | None,
205220
) -> None:
206221
"""Test that we can read role UUIDs whatever the validity of roles."""
207222
itsystem_uuid = create_itsystem(
208223
{
209224
"user_key": "suila",
210225
"name": "Suila-tapit",
211-
"validity": {"from": "2024-01-01"},
226+
"validity": {
227+
"from": itsystem_start.isoformat(),
228+
"to": itsystem_end.isoformat() if itsystem_end else None,
229+
},
212230
}
213231
)
214232
# Create a rolebinding role

0 commit comments

Comments
 (0)