Fix bug 1505 43/10643/3
authorDavid Garcia <david.garcia@canonical.com>
Thu, 15 Apr 2021 08:15:29 +0000 (10:15 +0200)
committergarciadav <david.garcia@canonical.com>
Thu, 15 Apr 2021 09:03:33 +0000 (11:03 +0200)
Delete ssh-key generation in N2VCConnector initialization

Change-Id: I5f33adf683ffeef34de270bf9b458a172dd4059d
Signed-off-by: David Garcia <david.garcia@canonical.com>
n2vc/n2vc_conn.py
n2vc/tests/unit/test_n2vc_juju_conn.py
tox.ini

index eada20b..ad0dc28 100644 (file)
@@ -117,7 +117,6 @@ class N2VCConnector(abc.ABC, Loggable):
         # generate private/public key-pair
         self.private_key_path = None
         self.public_key_path = None
-        self.get_public_key()
 
     @abc.abstractmethod
     async def get_status(self, namespace: str, yaml_format: bool = True):
index 1f723fe..e5e26be 100644 (file)
@@ -15,6 +15,9 @@
 
 import asyncio
 import logging
+from unittest.mock import Mock
+
+
 import asynctest
 from n2vc.n2vc_juju_conn import N2VCJujuConnector
 from osm_common import fslocal
@@ -51,6 +54,7 @@ class N2VCJujuConnTestCase(asynctest.TestCase):
 
         logging.disable(logging.CRITICAL)
 
+        N2VCJujuConnector.get_public_key = Mock()
         self.n2vc = N2VCJujuConnector(
             db=db,
             fs=fslocal.FsLocal(),
@@ -61,6 +65,7 @@ class N2VCJujuConnTestCase(asynctest.TestCase):
             vca_config=vca_config,
             on_update_db=None,
         )
+        N2VCJujuConnector.get_public_key.assert_not_called()
 
 
 @asynctest.mock.patch("n2vc.libjuju.Libjuju.get_metrics")
diff --git a/tox.ini b/tox.ini
index 21fc186..816de79 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -110,6 +110,7 @@ whitelist_externals = sh
 ignore =
         W291,
         W293,
+        W503,
         E123,
         E125,
         E226,