From c68f99e05f0ee74a7594c1a1e2123870192739c9 Mon Sep 17 00:00:00 2001 From: Chris Snow Date: Tue, 4 Aug 2020 22:22:00 +0000 Subject: [PATCH] add notes for next refactor Signed-off-by: Chris Snow --- tests/catalog_test.py | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/tests/catalog_test.py b/tests/catalog_test.py index 5f91e564..9888ca5c 100644 --- a/tests/catalog_test.py +++ b/tests/catalog_test.py @@ -23,6 +23,7 @@ import unittest from textwrap import dedent +import wrapt import yaml from mock import patch @@ -35,11 +36,27 @@ # setup the mock data mockApiSetup() +from .catalog_mock_api_responses import BaseTestCase + +# httpPostHandlers = BaseTestCase.httpPostHandlers + class TestCatalogGet(BaseTestCase): - @patch("requests.get", side_effect=BaseTestCase.httpGetHandlers) + + # TODO: ... + # @patch( + # target="requests.post", + # side_effect=catalog_mocks( + # {"default_login_reponse": "https://127.0.0.1:8080/api/v1/login"} + # ), + # ) @patch("requests.post", side_effect=BaseTestCase.httpPostHandlers) - def test_get_catalog_id_type(self, mock_get, mock_post): + def test_get_catalog_id_type(self, catalog_mocks): + + # E.g. mock remote exception response for /api/v1/login + # catalog_mocks.set( + # "https://127.0.0.1:8080/api/v1/login", "remote_exception" + # ) with self.assertRaisesRegexp( AssertionError, "'id' must be provided and must be a str",