diff options
author | James Falcon <james.falcon@canonical.com> | 2021-10-15 19:53:42 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-15 18:53:42 -0600 |
commit | a9501251aadf6d30192f7bd7debeabc9c3e29420 (patch) | |
tree | 209b109dd17834b35975c52d2d49a532bdd6ef13 /tests/unittests/test_distros | |
parent | b3e31ba228d32c318872fb68edda272f679e1004 (diff) | |
download | vyos-cloud-init-a9501251aadf6d30192f7bd7debeabc9c3e29420.tar.gz vyos-cloud-init-a9501251aadf6d30192f7bd7debeabc9c3e29420.zip |
testing: add get_cloud function (SC-461) (#1038)
Also added supporting distro/datasource classes and updated tests
that have a `get_cloud` call.
Diffstat (limited to 'tests/unittests/test_distros')
-rw-r--r-- | tests/unittests/test_distros/test_create_users.py | 43 |
1 files changed, 4 insertions, 39 deletions
diff --git a/tests/unittests/test_distros/test_create_users.py b/tests/unittests/test_distros/test_create_users.py index 021866b7..685f08ba 100644 --- a/tests/unittests/test_distros/test_create_users.py +++ b/tests/unittests/test_distros/test_create_users.py @@ -5,44 +5,7 @@ import re from cloudinit import distros from cloudinit import ssh_util from cloudinit.tests.helpers import (CiTestCase, mock) - - -class MyBaseDistro(distros.Distro): - # MyBaseDistro is here to test base Distro class implementations - - def __init__(self, name="basedistro", cfg=None, paths=None): - if not cfg: - cfg = {} - if not paths: - paths = {} - super(MyBaseDistro, self).__init__(name, cfg, paths) - - def install_packages(self, pkglist): - raise NotImplementedError() - - def _write_network(self, settings): - raise NotImplementedError() - - def package_command(self, command, args=None, pkgs=None): - raise NotImplementedError() - - def update_package_sources(self): - raise NotImplementedError() - - def apply_locale(self, locale, out_fn=None): - raise NotImplementedError() - - def set_timezone(self, tz): - raise NotImplementedError() - - def _read_hostname(self, filename, default=None): - raise NotImplementedError() - - def _write_hostname(self, hostname, filename): - raise NotImplementedError() - - def _read_system_hostname(self): - raise NotImplementedError() +from tests.unittests.util import abstract_to_concrete @mock.patch("cloudinit.distros.util.system_is_snappy", return_value=False) @@ -53,7 +16,9 @@ class TestCreateUser(CiTestCase): def setUp(self): super(TestCreateUser, self).setUp() - self.dist = MyBaseDistro() + self.dist = abstract_to_concrete(distros.Distro)( + name='test', cfg=None, paths=None + ) def _useradd2call(self, args): # return a mock call for the useradd command in args |