Changeset View
Changeset View
Standalone View
Standalone View
swh/journal/tests/test_replay.py
Show First 20 Lines • Show All 98 Lines • ▼ Show 20 Lines | for origin in origins: | ||||
if visit['origin'] == origin['url'] | if visit['origin'] == origin['url'] | ||||
] | ] | ||||
actual_visits = list(storage.origin_visit_get( | actual_visits = list(storage.origin_visit_get( | ||||
origin_url)) | origin_url)) | ||||
for visit in actual_visits: | for visit in actual_visits: | ||||
del visit['visit'] # opaque identifier | del visit['visit'] # opaque identifier | ||||
assert expected_visits == actual_visits | assert expected_visits == actual_visits | ||||
contents = list(storage.content_get_metadata( | input_contents = OBJECT_TYPE_KEYS['content'][1] | ||||
[cont['sha1'] for cont in OBJECT_TYPE_KEYS['content'][1]])) | contents = storage.content_get_metadata( | ||||
assert None not in contents | [cont['sha1'] for cont in input_contents]) | ||||
assert contents == OBJECT_TYPE_KEYS['content'][1] | assert len(contents) == len(input_contents) | ||||
assert contents == {cont['sha1']: [cont] for cont in input_contents} | |||||
vlorentz: ```
assert contents == {cont['sha1']: cont for cont in input_contents}
```
will also check… | |||||
Done Inline Actionsassert contents == {cont['sha1']: [cont] for cont in input_contents} will adapt ardumont: ```
assert contents == {cont['sha1']: [cont] for cont in input_contents}
```
will adapt | |||||
def _test_write_replay_origin_visit(visits): | def _test_write_replay_origin_visit(visits): | ||||
"""Helper function to write tests for origin_visit. | """Helper function to write tests for origin_visit. | ||||
Each visit (a dict) given in the 'visits' argument will be sent to | Each visit (a dict) given in the 'visits' argument will be sent to | ||||
a (mocked) kafka queue, which a in-memory-storage backed replayer is | a (mocked) kafka queue, which a in-memory-storage backed replayer is | ||||
listening to. | listening to. | ||||
▲ Show 20 Lines • Show All 117 Lines • Show Last 20 Lines |
will also check there are no extra data (it's unlikely to happen, but it doesn't hurt to check it)