forked from gitlabform/gitlabform
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix output of expiry dates (gitlabform#656)
The datetime.date object used for access expiration etc. is not supporting JSON serialization. Trying to do this for debug output reasons ends with an exception. The json.dumps() function offers to specify a default handling of unsupported types which is utilized here. Resolves: gitlabform#654 Co-authored-by: Roger Lehmann <[email protected]>
- Loading branch information
1 parent
aa26e66
commit 0c85c05
Showing
2 changed files
with
21 additions
and
1 deletion.
There are no files selected for viewing
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,20 @@ | ||
import datetime | ||
|
||
from gitlabform.util import to_str | ||
|
||
|
||
def test_date_stringification(): | ||
example_project_config = { | ||
"members": { | ||
"enforce": True, | ||
"users": { | ||
"project_204_bot": {"access_level": 40}, | ||
"project_204_bot_211c9f071a88910e7ed518cc5d81436a": { | ||
"access_level": 40, | ||
"expires_at": datetime.date(2024, 12, 12), | ||
}, | ||
}, | ||
} | ||
} | ||
output = to_str(example_project_config) | ||
assert type(output) is str |