From 19da2b852804c27c7d04484eea89feb212874254 Mon Sep 17 00:00:00 2001 From: David Garcia Date: Thu, 15 Apr 2021 10:15:29 +0200 Subject: [PATCH] Fix bug 1505 Delete ssh-key generation in N2VCConnector initialization Change-Id: I5f33adf683ffeef34de270bf9b458a172dd4059d Signed-off-by: David Garcia --- n2vc/n2vc_conn.py | 1 - n2vc/tests/unit/test_n2vc_juju_conn.py | 5 +++++ tox.ini | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/n2vc/n2vc_conn.py b/n2vc/n2vc_conn.py index eada20b..ad0dc28 100644 --- a/n2vc/n2vc_conn.py +++ b/n2vc/n2vc_conn.py @@ -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): diff --git a/n2vc/tests/unit/test_n2vc_juju_conn.py b/n2vc/tests/unit/test_n2vc_juju_conn.py index 1f723fe..e5e26be 100644 --- a/n2vc/tests/unit/test_n2vc_juju_conn.py +++ b/n2vc/tests/unit/test_n2vc_juju_conn.py @@ -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 --- a/tox.ini +++ b/tox.ini @@ -110,6 +110,7 @@ whitelist_externals = sh ignore = W291, W293, + W503, E123, E125, E226, -- 2.25.1