Skip to content

Commit 7c612e1

Browse files
committed
[1/2] Fix: Repeat manifest requests after failed generation raise InvalidGeneration (#212)
Add test
1 parent 79258c4 commit 7c612e1

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

test/service/test_manifest_async.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@
3636
from app_test_case import (
3737
LocalAppTestCase,
3838
)
39-
from azul.collections import (
40-
deep_dict_merge,
39+
from azul.json import (
40+
copy_json,
4141
)
4242
from azul.logging import (
4343
configure_test_logging,
@@ -214,7 +214,7 @@ def wrapper(*args, **kwargs):
214214
for format, fetch in product([ManifestFormat.compact, ManifestFormat.curl],
215215
[True, False]):
216216
with self.subTest(format=format, fetch=fetch):
217-
filters = {'organ': {'is': ['lymph node']}, 'fileFormat': {'is': ['txt']}}
217+
filters = {'fileFormat': {'is': ['txt']}, 'organ': {'is': ['heart', 'lung']}}
218218
filters = Filters(explicit=filters, source_ids={self.source.id})
219219
params = {
220220
'catalog': self.catalog,
@@ -471,7 +471,7 @@ def modified_put():
471471
sign_manifest_key.return_value = signed_manifest_key
472472
equivalent_url = initial_url.copy()
473473
equivalent_filters = json.loads(equivalent_url.args['filters'])
474-
equivalent_filters = dict(reversed(equivalent_filters.items()))
474+
equivalent_filters['organ']['is'].reverse()
475475
equivalent_url.args['filters'] = json.dumps(equivalent_filters)
476476
url = self._request('PUT', equivalent_url, expect=302)
477477
self.assertEqual(final_url, url)
@@ -489,10 +489,8 @@ def modified_put():
489489
def modified_put_after_expiration():
490490
nonlocal url, state, token_url, equivalent_input
491491
get_cached_manifest.side_effect = not_found
492-
equivalent_input = deep_dict_merge(
493-
{'filters': {'explicit': equivalent_filters}},
494-
input
495-
)
492+
equivalent_input = copy_json(input)
493+
equivalent_input['filters']['explicit'] = equivalent_filters
496494
iterations.append(equivalent_input)
497495
mock_start_generation()
498496
url = self._request('PUT', equivalent_url, expect=301)

0 commit comments

Comments
 (0)