-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Default to MISSING for GroupPolicies ha timeout
By defaulting to `MISSING`, we make it possible to treat an explicit `None` as a request for `null` in the payload.
- Loading branch information
Showing
3 changed files
with
37 additions
and
2 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
changelog.d/20231025_125551_sirosen_introduce_missingtype.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Changed | ||
~~~~~~~ | ||
|
||
- ``GroupPolicies`` objects now treat an explicit instantiation with | ||
``high_assurance_timeout=None`` as setting the timeout to ``null`` (:pr:`NUMBER`) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
from globus_sdk import GroupPolicies | ||
|
||
|
||
def test_group_policies_can_explicitly_null_ha_timeout(): | ||
# step 1: confirm that the auth assurance timeout is not in the baseline | ||
# doc which does not specify it | ||
kwargs = { | ||
"is_high_assurance": True, | ||
"group_visibility": "private", | ||
"group_members_visibility": "members", | ||
"join_requests": False, | ||
"signup_fields": [], | ||
} | ||
baseline = GroupPolicies(**kwargs) | ||
assert isinstance(baseline, GroupPolicies) | ||
assert "authentication_assurance_timeout" not in baseline | ||
|
||
# step 2: confirm that the auth assurance timeout is in the doc when | ||
# set to an integer value, even 0 | ||
kwargs["authentication_assurance_timeout"] = 0 | ||
with_falsy_timeout = GroupPolicies(**kwargs) | ||
assert with_falsy_timeout["authentication_assurance_timeout"] == 0 | ||
|
||
# step 3: confirm that the auth assurance timeout is in the doc when | ||
# set to None | ||
kwargs["authentication_assurance_timeout"] = None | ||
with_null_timeout = GroupPolicies(**kwargs) | ||
assert with_null_timeout["authentication_assurance_timeout"] is None |