aboutsummaryrefslogtreecommitdiffstats
path: root/app/test/fetch/api_fetch/test_api_fetch_projects.py
diff options
context:
space:
mode:
authorIlia Abashin <abashinos@gmail.com>2017-08-23 12:56:18 +0300
committerIlia Abashin <abashinos@gmail.com>2017-08-23 13:17:07 +0300
commit13767be99f8815395be01edc5c97735cdc66590b (patch)
treebbfd7c2176344f1b8f6bc83f5e92f0e91cfaab79 /app/test/fetch/api_fetch/test_api_fetch_projects.py
parent6519f3a2723827b7785fd13690b4c53b28eb325d (diff)
Refactored api fetch tests to use mocked requests
Also fixed some mocking logic Change-Id: I826fc1c03af1244cf10d9edee37c7c8f732c3602 Signed-off-by: Ilia Abashin <abashinos@gmail.com>
Diffstat (limited to 'app/test/fetch/api_fetch/test_api_fetch_projects.py')
-rw-r--r--app/test/fetch/api_fetch/test_api_fetch_projects.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/app/test/fetch/api_fetch/test_api_fetch_projects.py b/app/test/fetch/api_fetch/test_api_fetch_projects.py
index 1db4237..959e4e5 100644
--- a/app/test/fetch/api_fetch/test_api_fetch_projects.py
+++ b/app/test/fetch/api_fetch/test_api_fetch_projects.py
@@ -18,12 +18,19 @@ from test.fetch.api_fetch.test_data.token import TOKEN
class TestApiFetchProjects(TestFetch):
def setUp(self):
+ super().setUp()
self.configure_environment()
+
+ self._v2_auth_pwd = ApiFetchProjects.v2_auth_pwd
ApiFetchProjects.v2_auth_pwd = MagicMock(return_value=TOKEN)
+
self.fetcher = ApiFetchProjects()
self.set_regions_for_fetcher(self.fetcher)
self.region = REGIONS[REGION_NAME]
- self.fetcher.get_region_url_nover = MagicMock(return_value=REGION_URL_NOVER)
+
+ self._get_region_url_nover = self.fetcher.get_region_url_nover
+ self.fetcher.get_region_url_nover = \
+ MagicMock(return_value=REGION_URL_NOVER)
def test_get_for_region(self):
# mock request endpoint
@@ -118,3 +125,9 @@ class TestApiFetchProjects(TestFetch):
test_case["token"],
test_case["expected_result"],
test_case["err_msg"])
+
+ def tearDown(self):
+ super().tearDown()
+ ApiFetchProjects.v2_auth_pwd = self._v2_auth_pwd
+ self.reset_regions_for_fetcher(self.fetcher)
+ self.fetcher.get_region_url_nover = self._get_region_url_nover