diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a0b2628 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +build +layers +.tox +interfaces +.testrepository +*__pycache__* +*.pyc diff --git a/.gitreview b/.gitreview new file mode 100644 index 0000000..91969e2 --- /dev/null +++ b/.gitreview @@ -0,0 +1,4 @@ +[gerrit] +host=review.openstack.org +port=29418 +project=openstack/charm-murano.git diff --git a/src/lib/charm/openstack/murano.py b/src/lib/charm/openstack/murano.py index 6704375..af548b1 100644 --- a/src/lib/charm/openstack/murano.py +++ b/src/lib/charm/openstack/murano.py @@ -46,7 +46,7 @@ class MuranoCharm(charms_openstack.charm.HAOpenStackCharm): """ if release is None: release = ch_utils.os_release('python-keystonemiddleware') - super(MuranoCharm, self).__init__(release=release, **kwargs) + super().__init__(release=release, **kwargs) def get_amqp_credentials(self): """Provide the default amqp username and vhost as a tuple. diff --git a/unit_tests/__init__.py b/unit_tests/__init__.py index 12469eb..3a5e9a3 100644 --- a/unit_tests/__init__.py +++ b/unit_tests/__init__.py @@ -13,34 +13,10 @@ # limitations under the License. import sys -import mock sys.path.append('src') sys.path.append('src/lib') # Mock out charmhelpers so that we can test without it. -# also stops sideeffects from occuring. -charmhelpers = mock.MagicMock() -apt_pkg = mock.MagicMock() -sys.modules['apt_pkg'] = apt_pkg -sys.modules['charmhelpers'] = charmhelpers -sys.modules['charmhelpers.core'] = charmhelpers.core -sys.modules['charmhelpers.core.decorators'] = charmhelpers.core.decorators -sys.modules['charmhelpers.core.hookenv'] = charmhelpers.core.hookenv -sys.modules['charmhelpers.core.host'] = charmhelpers.core.host -sys.modules['charmhelpers.core.unitdata'] = charmhelpers.core.unitdata -sys.modules['charmhelpers.core.templating'] = charmhelpers.core.templating -sys.modules['charmhelpers.contrib'] = charmhelpers.contrib -sys.modules['charmhelpers.contrib.openstack'] = charmhelpers.contrib.openstack -sys.modules['charmhelpers.contrib.openstack.utils'] = ( - charmhelpers.contrib.openstack.utils) -sys.modules['charmhelpers.contrib.openstack.templating'] = ( - charmhelpers.contrib.openstack.templating) -sys.modules['charmhelpers.contrib.network'] = charmhelpers.contrib.network -sys.modules['charmhelpers.contrib.network.ip'] = ( - charmhelpers.contrib.network.ip) -sys.modules['charmhelpers.fetch'] = charmhelpers.fetch -sys.modules['charmhelpers.cli'] = charmhelpers.cli -sys.modules['charmhelpers.contrib.hahelpers'] = charmhelpers.contrib.hahelpers -sys.modules['charmhelpers.contrib.hahelpers.cluster'] = ( - charmhelpers.contrib.hahelpers.cluster) +import charms_openstack.test_mocks # noqa +charms_openstack.test_mocks.mock_charmhelpers() diff --git a/unit_tests/test_lib_charm_openstack_murano.py b/unit_tests/test_lib_charm_openstack_murano.py index b200486..692880f 100644 --- a/unit_tests/test_lib_charm_openstack_murano.py +++ b/unit_tests/test_lib_charm_openstack_murano.py @@ -72,15 +72,7 @@ class Helper(unittest.TestCase): class TestMuranoCharm(Helper): - def test_install(self): - self.patch(murano.MuranoCharm, 'configure_source') - a = murano.MuranoCharm(release='mitaka') - a.install() - self.configure_source.assert_called_with() - def test__init__(self): - self.patch(murano.MuranoCharm, - 'set_config_defined_certs_and_keys') self.patch(murano.ch_utils, 'os_release') murano.MuranoCharm() self.os_release.assert_called_once_with('python-keystonemiddleware')