diff options
author | BonfaceKilz | 2021-03-02 11:09:46 +0300 |
---|---|---|
committer | BonfaceKilz | 2021-03-08 21:09:58 +0300 |
commit | e5ed256a0599eeb53e2067c3d6b928783bc4c27e (patch) | |
tree | 8cbecd04183b41653f0c0405db437eb5048a2eb4 /tests/integration/test_general.py | |
parent | 1bceba1b421c9f57095e1fa3cb6e872cec9ae4bb (diff) | |
download | genenetwork3-e5ed256a0599eeb53e2067c3d6b928783bc4c27e.tar.gz |
Update failing tests.
Diffstat (limited to 'tests/integration/test_general.py')
-rw-r--r-- | tests/integration/test_general.py | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/tests/integration/test_general.py b/tests/integration/test_general.py index 9422ee4..76cc754 100644 --- a/tests/integration/test_general.py +++ b/tests/integration/test_general.py @@ -2,6 +2,7 @@ import os import unittest +from unittest import mock from gn3.app import create_app @@ -12,28 +13,33 @@ class GeneralAPITest(unittest.TestCase): def test_metadata_endpoint_exists(self): """Test that /metadata/upload exists""" - response = self.app.post("/metadata/upload") + response = self.app.post("/metadata/upload/d41d86-e4ceEo") self.assertEqual(response.status_code, 400) self.assertEqual(response.get_json(), {"status": 128, "error": "Please provide a file!"}) - def test_metadata_file_upload(self): + @mock.patch("gn3.api.general.extract_uploaded_file") + def test_metadata_file_upload(self, mock_extract_upload): """Test correct upload of file""" + mock_extract_upload.return_value = { + "status": 0, + "token": "d41d86-e4ceEo", + } gzip_file = os.path.abspath(os.path.join( os.path.dirname(__file__), "../unit/upload-data.tar.gz")) - response = self.app.post("/metadata/upload", + response = self.app.post("/metadata/upload/d41d86-e4ceEo", data={"file": (gzip_file, "upload-data.tar.gz")}) self.assertEqual(response.status_code, 201) self.assertEqual(response.get_json(), {"status": 0, - "token": "d41d8cd98f00b204e9800998ecf8427e"}) + "token": "d41d86-e4ceEo"}) def test_metadata_file_wrong_upload(self): """Test that incorrect upload return correct status code""" - response = self.app.post("/metadata/upload", + response = self.app.post("/metadata/upload/d41d86-e4ceEo", data={"file": (__file__, "my_file")}) self.assertEqual(response.status_code, 500) |