|
10 | 10 | apikey = 'TESTAPIKEY'
|
11 | 11 |
|
12 | 12 |
|
13 |
| -@pytest.mark.parametrize('store_params, security, expected_store_tasks', [ |
| 13 | +@pytest.mark.parametrize('default_storage, store_params, security, expected_store_tasks', [ |
14 | 14 | (
|
15 |
| - {'location': 's3'}, |
| 15 | + 'S3,', |
| 16 | + {'location': 'gcs'}, |
16 | 17 | None,
|
17 | 18 | [
|
18 | 19 | {
|
19 |
| - 'name': 'store', 'params': {'location': 's3'} |
| 20 | + 'name': 'store', 'params': {'location': 'gcs'} |
20 | 21 | }
|
21 | 22 | ]
|
22 | 23 | ),
|
23 | 24 | (
|
| 25 | + 'gcs', |
24 | 26 | {'path': 'new-path/', 'mimetype': 'application/json'},
|
25 | 27 | type('SecurityMock', (), {'policy_b64': 'abc', 'signature': '123'}),
|
26 | 28 | [
|
27 | 29 | {
|
28 |
| - 'name': 'store', 'params': {'path': 'new-path/'} |
| 30 | + 'name': 'store', 'params': {'path': 'new-path/', 'location': 'gcs'} |
29 | 31 | },
|
30 | 32 | {
|
31 | 33 | 'name': 'security', 'params': {'policy': 'abc', 'signature': '123'}
|
|
34 | 36 | )
|
35 | 37 | ])
|
36 | 38 | @patch('filestack.uploads.external_url.requests.post')
|
37 |
| -def test_upload_with_store_params(post_mock, store_params, security, expected_store_tasks): |
| 39 | +def test_upload_with_store_params(post_mock, default_storage, store_params, security, expected_store_tasks): |
38 | 40 | expected_payload = {
|
39 | 41 | 'apikey': 'TESTAPIKEY',
|
40 | 42 | 'sources': ['http://image.url'],
|
41 | 43 | 'tasks': expected_store_tasks
|
42 | 44 | }
|
43 | 45 | post_mock.return_value = DummyHttpResponse(json_dict={'handle': 'newHandle'})
|
44 | 46 |
|
45 |
| - upload_response = upload_external_url(url, apikey, store_params=store_params, security=security) |
| 47 | + upload_response = upload_external_url( |
| 48 | + url, apikey, default_storage, store_params=store_params, security=security |
| 49 | + ) |
46 | 50 | assert upload_response['handle'] == 'newHandle'
|
47 | 51 | post_args, _ = post_mock.call_args
|
48 | 52 | post_mock.assert_called_once_with('{}/process'.format(config.CDN_URL), json=expected_payload)
|
0 commit comments