From b11dae55f54720759431107e83f1070c10aacd96 Mon Sep 17 00:00:00 2001 From: Michael Hwang Date: Fri, 2 Mar 2018 20:46:21 -0500 Subject: Make tox work in a fresh scenario Severing the unit tests from the local config dependency meant refactoring code that made pure unit testing impossible. Introduced a conftest in this commit. Change-Id: Id005b8b5b0704ccac33fa8768be1642941281f34 Issue-ID: DCAEGEN2-372 Signed-off-by: Michael Hwang --- .../dcae_cli/catalog/mock/tests/test_mock_catalog.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'dcae-cli/dcae_cli/catalog/mock/tests/test_mock_catalog.py') diff --git a/dcae-cli/dcae_cli/catalog/mock/tests/test_mock_catalog.py b/dcae-cli/dcae_cli/catalog/mock/tests/test_mock_catalog.py index 0c0a4e8..75b883d 100644 --- a/dcae-cli/dcae_cli/catalog/mock/tests/test_mock_catalog.py +++ b/dcae-cli/dcae_cli/catalog/mock/tests/test_mock_catalog.py @@ -1,7 +1,7 @@ # ============LICENSE_START======================================================= # org.onap.dcae # ================================================================================ -# Copyright (c) 2017 AT&T Intellectual Property. All rights reserved. +# Copyright (c) 2017-2018 AT&T Intellectual Property. All rights reserved. # ================================================================================ # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -277,7 +277,7 @@ _cdap_spec={ } -def test_component_basic(catalog=None): +def test_component_basic(mock_cli_config, catalog=None): '''Tests basic component usage of MockCatalog''' if catalog is None: mc = MockCatalog(db_name='dcae_cli.test.db', purge_existing=True, enforce_image=False) @@ -312,7 +312,7 @@ def test_component_basic(catalog=None): assert cver == '1.0.0' -def test_format_basic(catalog=None): +def test_format_basic(mock_cli_config, catalog=None): '''Tests basic data format usage of MockCatalog''' if catalog is None: mc = MockCatalog(db_name='dcae_cli.test.db', purge_existing=True) @@ -351,7 +351,7 @@ def test_format_basic(catalog=None): assert spec['self']['description'] == new_descr -def test_discovery(catalog=None): +def test_discovery(mock_cli_config, catalog=None): '''Tests creation of discovery objects''' if catalog is None: mc = MockCatalog(db_name='dcae_cli.test.db', purge_existing=True, enforce_image=False) @@ -393,7 +393,7 @@ def _format_tuple_set(*dds): return set(map(_format_tuple, dds)) -def test_comp_list(catalog=None): +def test_comp_list(mock_cli_config, catalog=None): '''Tests the list functionality of the catalog''' if catalog is None: mc = MockCatalog(db_name='dcae_cli.test.db', purge_existing=True, enforce_image=False) @@ -479,7 +479,7 @@ def test_comp_list(catalog=None): assert len(components) == 4 -def test_format_list(catalog=None): +def test_format_list(mock_cli_config, catalog=None): '''Tests the list functionality of the catalog''' if catalog is None: mc = MockCatalog(db_name='dcae_cli.test.db', purge_existing=True, enforce_image=False) @@ -523,7 +523,7 @@ def test_format_list(catalog=None): assert len(formats) == 2 -def test_component_add_cdap(catalog=None): +def test_component_add_cdap(mock_cli_config, catalog=None): '''Adds a mock CDAP application''' if catalog is None: mc = MockCatalog(db_name='dcae_cli.test.db', purge_existing=True) @@ -548,7 +548,7 @@ def test_component_add_cdap(catalog=None): assert _cdap_spec == spec_out -def test_get_discovery_from_spec(): +def test_get_discovery_from_spec(mock_cli_config): mc = MockCatalog(db_name='dcae_cli.test.db', purge_existing=True, enforce_image=False) @@ -635,7 +635,7 @@ def test_get_discovery_from_spec(): assert actual_dmaap_config_keys == ([], []) -def test_get_unpublished_formats(catalog=None): +def test_get_unpublished_formats(mock_cli_config, catalog=None): if catalog is None: mc = MockCatalog(db_name='dcae_cli.test.db', purge_existing=True, enforce_image=False) else: -- cgit 1.2.3-korg