diff --git a/swh/journal/tests/test_replay.py b/swh/journal/tests/test_replay.py --- a/swh/journal/tests/test_replay.py +++ b/swh/journal/tests/test_replay.py @@ -83,17 +83,20 @@ assert OBJECT_TYPE_KEYS['origin'][1] == \ [{'url': orig['url'], 'type': orig['type']} for orig in origins] for origin in origins: + origin_id_or_url = \ + origin['id'] if ENABLE_ORIGIN_IDS else origin['url'] expected_visits = [ { **visit, - 'origin': origin['id'], + 'origin': origin_id_or_url, 'date': dateutil.parser.parse(visit['date']), } for visit in OBJECT_TYPE_KEYS['origin_visit'][1] if visit['origin']['url'] == origin['url'] and visit['origin']['type'] == origin['type'] ] - actual_visits = list(storage.origin_visit_get(origin['id'])) + actual_visits = list(storage.origin_visit_get( + origin_id_or_url)) for visit in actual_visits: del visit['visit'] # opaque identifier assert expected_visits == actual_visits @@ -145,7 +148,7 @@ else: assert visits == [{ 'visit': 1, - 'origin': {'url': 'http://example.com/'}, + 'origin': 'http://example.com/', 'date': now, }] @@ -192,7 +195,7 @@ else: assert visits == [{ 'visit': 1, - 'origin': {'url': 'http://example.com/'}, + 'origin': 'http://example.com/', 'date': now, 'type': 'git', }] diff --git a/tox.ini b/tox.ini --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist=flake8,py3 +envlist=flake8,py3-no-origin-ids,py3 [testenv:py3] passenv=SWH_KAFKA_ROOT @@ -9,6 +9,16 @@ commands = pytest --cov=swh --cov-branch {posargs} +[testenv:py3-no-origin-ids] +passenv=SWH_KAFKA_ROOT +deps = + .[testing] + pytest-cov +setenv = + SWH_STORAGE_IN_MEMORY_ENABLE_ORIGIN_IDS=false +commands = + pytest --cov=swh --cov-branch {posargs} + [testenv:flake8] skip_install = true deps =