Repository: opendatacube/datacube-wps (language: python)

Issue:
Cover S3 Upload functions with moto based tests
### Expected behaviour
S3 Upload functions are covered by tests

### Actual behaviour
S3 upload functions are untested


### Steps to reproduce the behaviour
Use [moto](https://github.com/spulec/moto) and [mock_s3](http://docs.getmoto.org/en/latest/docs/getting_started.html#decorator) to test these functions



Discussion / hints:

Fix patch:
diff --git a/.gitignore b/.gitignore
index aeaccfa..7b247d7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,4 +7,6 @@ build
 .DS_Store
 *.egg-info/
 dist/
-tmp/
\ No newline at end of file
+tmp/
+geckodriver.log
+venv/
\ No newline at end of file
diff --git a/datacube_wps/processes/__init__.py b/datacube_wps/processes/__init__.py
index de30e51..9f3f3f8 100644
--- a/datacube_wps/processes/__init__.py
+++ b/datacube_wps/processes/__init__.py
@@ -90,14 +90,14 @@ def _uploadToS3(filename, data, mimetype):
                                      Params={'Bucket': bucket, 'Key': filename})
 
 
-def upload_chart_html_to_S3(chart, process_id):
+def upload_chart_html_to_S3(chart : altair.Chart, process_id : str):
     html_io = io.StringIO()
     chart.save(html_io, format='html')
     html_bytes = io.BytesIO(html_io.getvalue().encode())
     return _uploadToS3(process_id + '/chart.html', html_bytes, 'text/html')
 
 
-def upload_chart_svg_to_S3(chart, process_id):
+def upload_chart_svg_to_S3(chart : altair.Chart, process_id : str):
     img_io = io.StringIO()
     chart.save(img_io, format='svg')
     img_bytes = io.BytesIO(img_io.getvalue().encode())
diff --git a/requirements.txt b/requirements.txt
index 76201ec..482d459 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -19,3 +19,5 @@ odc-ppt
 pylint
 pytest
 pytest-cov
+moto==1.3.16
+vega-datasets==0.9.0
\ No newline at end of file


Test patch:
diff --git a/tests/test_s3.py b/tests/test_s3.py
new file mode 100644
index 0000000..70a4170
--- /dev/null
+++ b/tests/test_s3.py
@@ -0,0 +1,35 @@
+from moto import mock_s3
+import boto3
+import altair as alt
+from vega_datasets import data
+import pywps.configuration as config
+
+from datacube_wps.processes import upload_chart_svg_to_S3, upload_chart_html_to_S3
+
+TEST_CHART = chart = (
+        alt.Chart(data.cars.url)
+        .mark_point()
+        .encode(x="Horsepower:Q", y="Miles_per_Gallon:Q", color="Origin:N")
+    )
+
+TEST_CFG = "pywps.cfg"
+
+@mock_s3
+def test_s3_svg_chart_upload():
+    config.load_configuration(TEST_CFG)
+    bucket = config.get_config_value("s3", "bucket")
+    region = config.get_config_value("s3", "region")
+    location = {'LocationConstraint': region}
+    client = boto3.client("s3",region_name=region)
+    client.create_bucket(Bucket=bucket,CreateBucketConfiguration=location)
+    upload_chart_svg_to_S3(TEST_CHART, "abcd")
+
+@mock_s3
+def test_s3_html_chart_upload():
+    config.load_configuration(TEST_CFG)
+    bucket = config.get_config_value("s3", "bucket")
+    region = config.get_config_value("s3", "region")
+    location = {'LocationConstraint': region}
+    client = boto3.client("s3",region_name=region)
+    client.create_bucket(Bucket=bucket,CreateBucketConfiguration=location)
+    upload_chart_html_to_S3(TEST_CHART, "abcd")