aboutsummaryrefslogtreecommitdiff
path: root/tests/integration/test_traits.py
diff options
context:
space:
mode:
authorAlexander Kabui2021-04-06 23:11:22 +0300
committerAlexander Kabui2021-04-06 23:11:22 +0300
commit8ce82f5b6cccc015c38a728864c63c026fe6a3a0 (patch)
tree3b5976a8c07c93e6c9318c4464596b0763e4f11a /tests/integration/test_traits.py
parenta1fcc30e84bd7201c852faf6f6a622face646ef8 (diff)
downloadgenenetwork3-8ce82f5b6cccc015c38a728864c63c026fe6a3a0.tar.gz
add mock db for tests
Diffstat (limited to 'tests/integration/test_traits.py')
-rw-r--r--tests/integration/test_traits.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/integration/test_traits.py b/tests/integration/test_traits.py
index 426bdd7..410ba22 100644
--- a/tests/integration/test_traits.py
+++ b/tests/integration/test_traits.py
@@ -13,10 +13,11 @@ class TraitIntegrationTest(TestCase):
self.app = create_app().test_client()
@mock.patch("gn3.api.traits.fetch_trait")
- def test_create_trait(self, mock_fetch_trait):
+ @mock.patch("gn3.api.traits.database_connector")
+ def test_create_trait(self, mock_database, mock_fetch_trait):
"""test the endpoint for creating traits\
endpoint requires trait name and dataset name"""
-
+ mock_database.return_value = (mock.Mock(), mock.Mock())
trait_results = {
"dataset": None,
"trait_name": "1449593_at",
@@ -36,6 +37,7 @@ class TraitIntegrationTest(TestCase):
trait_data = results.get_json()
+ self.assertEqual(mock_database.call_count, 1)
self.assertEqual(results.status_code, 200)
self.assertEqual(trait_data, trait_results)