Skip to content

Commit 355ab6f

Browse files
committed
update tests
1 parent d0bff70 commit 355ab6f

File tree

1 file changed

+24
-10
lines changed

1 file changed

+24
-10
lines changed

geospaas_rest_api/tests/test_processing_api.py

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ def test_list_tasks(self):
4545
'task_args': "((1, 'ftp://test/dataset_1_S3A_OL_1_EFR____20181213T024322_20181213T024622_20181214T065355_0179_039_089_2340_LN1_O_NT_002.zip'),)",
4646
'date_created': '2020-07-16T13:58:22.918000Z',
4747
'date_done': '2020-07-16T13:58:21.201000Z',
48-
'meta': "{\"children\": []}"
48+
'meta': "{\"children\": []}",
49+
'periodic_task_name': None,
4950
}, {
5051
'id': 3,
5152
'content_encoding': 'utf-8',
@@ -60,7 +61,8 @@ def test_list_tasks(self):
6061
'task_args': "((1, 'ftp://test/dataset_1_S3A_OL_1_EFR____20181213T024322_20181213T024622_20181214T065355_0179_039_089_2340_LN1_O_NT_002.zip'),)",
6162
'date_created': '2020-07-16T13:57:21.918000Z',
6263
'date_done': '2020-07-16T13:57:21.918000Z',
63-
'meta': "{\"children\": []}"
64+
'meta': "{\"children\": []}",
65+
'periodic_task_name': None,
6466
}, {
6567
'id': 2,
6668
'content_encoding': 'utf-8',
@@ -75,7 +77,8 @@ def test_list_tasks(self):
7577
'task_args': '(1,)',
7678
'date_created': '2020-07-16T13:53:33.864000Z',
7779
'date_done': '2020-07-16T13:57:21.912000Z',
78-
'meta': "{\"children\": [[[\"733d3a63-7a5a-4a1e-8cf0-750ae393dd98\", null], null]]}"
80+
'meta': "{\"children\": [[[\"733d3a63-7a5a-4a1e-8cf0-750ae393dd98\", null], null]]}",
81+
'periodic_task_name': None,
7982
}, {
8083
'id': 1,
8184
'content_encoding': 'utf-8',
@@ -90,7 +93,8 @@ def test_list_tasks(self):
9093
'task_args': '(1,)',
9194
'date_created': '2020-07-16T13:52:33.864000Z',
9295
'date_done': '2020-07-16T13:52:33.864000Z',
93-
'meta': "{\"children\": []}"
96+
'meta': "{\"children\": []}",
97+
'periodic_task_name': None,
9498
}
9599
]
96100
}
@@ -113,7 +117,8 @@ def test_retrieve_task(self):
113117
"date_created": "2020-07-16T13:52:33.864000Z",
114118
"date_done": "2020-07-16T13:52:33.864000Z",
115119
"traceback": None,
116-
"meta": "{\"children\": []}"
120+
"meta": "{\"children\": []}",
121+
"periodic_task_name": None,
117122
})
118123

119124

@@ -192,9 +197,11 @@ def test_get_signature_no_cropping(self):
192197
mock_chain.assert_has_calls([
193198
mock.call([
194199
mock_tasks.download.signature.return_value,
200+
mock_tasks.copy.signature.return_value,
195201
]),
196202
mock.call([
197203
mock_tasks.download.signature.return_value,
204+
mock_tasks.copy.signature.return_value,
198205
mock_tasks.archive.signature.return_value,
199206
mock_tasks.publish.signature.return_value,
200207
]),
@@ -210,11 +217,13 @@ def test_get_signature_cropping(self):
210217
mock_chain.assert_has_calls([
211218
mock.call([
212219
mock_tasks.download.signature.return_value,
220+
mock_tasks.copy.signature.return_value,
213221
mock_tasks.unarchive.signature.return_value,
214222
mock_tasks.crop.signature.return_value,
215223
]),
216224
mock.call([
217225
mock_tasks.download.signature.return_value,
226+
mock_tasks.copy.signature.return_value,
218227
mock_tasks.unarchive.signature.return_value,
219228
mock_tasks.crop.signature.return_value,
220229
mock_tasks.archive.signature.return_value,
@@ -237,8 +246,10 @@ def test_check_parameters_wrong_key(self):
237246
models.DownloadJob.check_parameters(parameters)
238247
self.assertListEqual(
239248
raised.exception.detail,
240-
[ErrorDetail(string="The download action accepts only one parameter: 'dataset_id'",
241-
code='invalid')])
249+
[ErrorDetail(
250+
string="The download action accepts only the following parameters:"
251+
" ('dataset_id', 'bounding_box', 'publish', 'copy_to')",
252+
code='invalid')])
242253

243254
def test_check_parameters_extra_param(self):
244255
"""`check_parameters()` must raise an exception if an extra parameter is given"""
@@ -247,7 +258,8 @@ def test_check_parameters_extra_param(self):
247258
models.DownloadJob.check_parameters(parameters)
248259
self.assertListEqual(
249260
raised.exception.detail,
250-
[ErrorDetail(string="The download action accepts only one parameter: 'dataset_id'",
261+
[ErrorDetail(string="The download action accepts only the following parameters:"
262+
" ('dataset_id', 'bounding_box', 'publish', 'copy_to')",
251263
code='invalid')])
252264

253265
def test_check_parameters_wrong_id_type(self):
@@ -296,7 +308,7 @@ def test_check_parameters_wrong_key(self):
296308
raised.exception.detail,
297309
[ErrorDetail(string="The convert action accepts only these parameters: "
298310
"dataset_id, format, bounding_box, skip_check, converter_options, "
299-
"remove_downloaded, ttl",
311+
"remove_downloaded, ttl, copy_to",
300312
code='invalid')])
301313

302314
def test_check_parameters_wrong_format(self):
@@ -316,7 +328,7 @@ def test_check_parameters_extra_param(self):
316328
raised.exception.detail,
317329
[ErrorDetail(string="The convert action accepts only these parameters: "
318330
"dataset_id, format, bounding_box, skip_check, converter_options, "
319-
"remove_downloaded, ttl",
331+
"remove_downloaded, ttl, copy_to",
320332
code='invalid')])
321333

322334
def test_check_parameters_wrong_type_for_dataset_id(self):
@@ -374,6 +386,7 @@ def test_get_signature_syntool(self):
374386
"""Test the right signature is returned"""
375387
base_chain = celery.chain(
376388
tasks_core.download.signature(),
389+
tasks_core.copy.signature(kwargs={'copy_to': None}),
377390
tasks_core.unarchive.signature(),
378391
tasks_core.crop.signature(
379392
kwargs={'bounding_box': [0, 20, 20, 0]}),
@@ -405,6 +418,7 @@ def test_get_signature_idf(self):
405418
}),
406419
celery.chain(
407420
tasks_core.download.signature(),
421+
tasks_core.copy.signature(kwargs={'copy_to': None}),
408422
tasks_core.unarchive.signature(),
409423
tasks_core.crop.signature(
410424
kwargs={'bounding_box': [0, 20, 20, 0]}),

0 commit comments

Comments
 (0)