-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
343704b
commit 586a34b
Showing
3 changed files
with
90 additions
and
81 deletions.
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,44 @@ | ||
from sentry.runner.commands.backup import DateUpdatedComparator, InstanceID | ||
|
||
|
||
def test_good_date_updated_comparator(): | ||
cmp = DateUpdatedComparator("my_date_field") | ||
id = InstanceID("test", 1) | ||
left = { | ||
"model": "test", | ||
"pk": 1, | ||
"fields": { | ||
"my_date_field": "2023-06-22T23:00:00.123Z", | ||
}, | ||
} | ||
right = { | ||
"model": "test", | ||
"pk": 1, | ||
"fields": { | ||
"my_date_field": "2023-06-22T23:00:00.123Z", | ||
}, | ||
} | ||
assert cmp.compare(id, left, right) is None | ||
|
||
|
||
def test_bad_date_updated_comparator(): | ||
cmp = DateUpdatedComparator("my_date_field") | ||
id = InstanceID("test", 1) | ||
left = { | ||
"model": "test", | ||
"pk": 1, | ||
"fields": { | ||
"my_date_field": "2023-06-22T23:12:34.567Z", | ||
}, | ||
} | ||
right = { | ||
"model": "test", | ||
"pk": 1, | ||
"fields": { | ||
"my_date_field": "2023-06-22T23:00:00.001Z", | ||
}, | ||
} | ||
res = cmp.compare(id, left, right) | ||
assert res is not None | ||
assert res.on == id | ||
assert res.kind == "DateUpdatedComparator" |
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