Skip to content

Commit 69ff86b

Browse files
eujingkrivard
authored andcommitted
Fixed jhu tests to mock s3 too
1 parent 814fe48 commit 69ff86b

File tree

3 files changed

+20
-4
lines changed

3 files changed

+20
-4
lines changed

jhu/params.json.template

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"base_url": "https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_{metric}_US.csv",
77
"aws_credentials": {
88
"aws_access_key_id": "",
9-
"aws_secret_access_key": "",
10-
}
9+
"aws_secret_access_key": ""
10+
},
11+
"bucket_name": ""
1112
}

jhu/tests/conftest.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
# -*- coding: utf-8 -*-
22

3+
from boto3 import Session
4+
from moto import mock_s3
35
import pytest
46

57
from os import listdir, remove
68
from os.path import join
79

10+
from delphi_utils import read_params
811
from delphi_jhu.run import run_module
912

1013

@@ -14,4 +17,11 @@ def run_as_module():
1417
for fname in listdir("receiving"):
1518
remove(join("receiving", fname))
1619

17-
run_module()
20+
with mock_s3():
21+
# Create the fake bucket we will be using
22+
params = read_params()
23+
aws_credentials = params["aws_credentials"]
24+
s3_client = Session(**aws_credentials).client("s3")
25+
s3_client.create_bucket(Bucket=params["bucket_name"])
26+
27+
run_module()

jhu/tests/params.json.template

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,10 @@
33
"static_file_dir": "../static",
44
"export_dir": "./receiving",
55
"cache_dir": "./cache",
6-
"base_url": "test_data/small_{metric}.csv"
6+
"base_url": "test_data/small_{metric}.csv",
7+
"aws_credentials": {
8+
"aws_access_key_id": "FAKE_TEST_ACCESS_KEY_ID",
9+
"aws_secret_access_key": "FAKE_TEST_SECRET_ACCESS_KEY"
10+
},
11+
"bucket_name": "test-bucket"
712
}

0 commit comments

Comments
 (0)