Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: remove check for default steps in kigfisher process #1069

Merged
merged 4 commits into from
Apr 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion kingfisher_scrapy/base_spiders/base_spider.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def __init__(self, sample=None, path=None, from_date=None, until_date=None, craw
self.kingfisher_process_note = note
self.kingfisher_process_keep_collection_open = keep_collection_open == 'true'
if steps is None:
self.kingfisher_process_steps = self.available_steps
self.kingfisher_process_steps = {'compile'}
else:
self.kingfisher_process_steps = set(steps.split(',')) & self.available_steps

Expand Down
15 changes: 10 additions & 5 deletions tests/extensions/test_kingfisher_process_api2.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,13 @@ def test_from_crawler_with_database_url():
@pytest.mark.parametrize('note', [None, 'Started by NAME.'])
@pytest.mark.parametrize('job', [None, '7df53218f37a11eb80dd0c9d92c523cb'])
@pytest.mark.parametrize('ocds_version,upgrade', [('1.0', True), (None, False)])
@pytest.mark.parametrize('steps', [None, 'compile,check,invalid', 'compile', 'check'])
@pytest.mark.parametrize('steps,expected_steps', [
(None, ['compile']),
('compile,check,invalid', ['compile', 'check']),
('compile', ['compile']),
('check', ['check']),
('', []),
])
@pytest.mark.parametrize('call_count,status_code,messages', [
(2, 200, [
('INFO', 'Created collection 1 in Kingfisher Process'), ('INFO', 'Closed collection 1 in Kingfisher Process')
Expand All @@ -149,6 +155,7 @@ def test_spider_opened(
ocds_version,
upgrade,
steps,
expected_steps,
call_count,
status_code,
messages,
Expand All @@ -174,10 +181,8 @@ def test_spider_opened(
'job': job,
'upgrade': upgrade,
}
if steps != 'check':
expected['compile'] = True
if steps != 'compile':
expected['check'] = True
for step in expected_steps:
expected[step] = True

calls = mock.call_args_list

Expand Down