diff options
author | zdc <zdc@users.noreply.github.com> | 2022-03-26 15:41:59 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-26 15:41:59 +0200 |
commit | aa60d48c2711cdcd9f88a4e5c77379adb0408231 (patch) | |
tree | 349631a02467dae0158f6f663cc8aa8537974a97 /tests/unittests/test_cs_util.py | |
parent | 5c4b3943343a85fbe517e5ec1fc670b3a8566b4b (diff) | |
parent | 31448cccedd8f841fb3ac7d0f2e3cdefe08a53ba (diff) | |
download | vyos-cloud-init-aa60d48c2711cdcd9f88a4e5c77379adb0408231.tar.gz vyos-cloud-init-aa60d48c2711cdcd9f88a4e5c77379adb0408231.zip |
Merge pull request #51 from zdc/T2117-sagitta-22.1
T2117: Cloud-init updated to 22.1
Diffstat (limited to 'tests/unittests/test_cs_util.py')
-rw-r--r-- | tests/unittests/test_cs_util.py | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/tests/unittests/test_cs_util.py b/tests/unittests/test_cs_util.py index bfd07ecf..109e0208 100644 --- a/tests/unittests/test_cs_util.py +++ b/tests/unittests/test_cs_util.py @@ -1,9 +1,7 @@ # This file is part of cloud-init. See LICENSE file for license information. -from cloudinit.tests import helpers as test_helpers - from cloudinit.cs_utils import Cepko - +from tests.unittests import helpers as test_helpers SERVER_CONTEXT = { "cpu": 1000, @@ -16,7 +14,7 @@ SERVER_CONTEXT = { "smp": 1, "tags": ["much server", "very performance"], "uuid": "65b2fb23-8c03-4187-a3ba-8b7c919e889", - "vnc_password": "9e84d6cb49e46379" + "vnc_password": "9e84d6cb49e46379", } @@ -25,7 +23,7 @@ class CepkoMock(Cepko): return SERVER_CONTEXT def get(self, key="", request_pattern=None): - return SERVER_CONTEXT['tags'] + return SERVER_CONTEXT["tags"] # 2015-01-22 BAW: This test is completely useless because it only ever tests @@ -34,33 +32,36 @@ class CepkoMock(Cepko): class CepkoResultTests(test_helpers.TestCase): def setUp(self): self.c = Cepko() - raise test_helpers.SkipTest('This test is completely useless') + raise test_helpers.SkipTest("This test is completely useless") def test_getitem(self): result = self.c.all() - self.assertEqual("65b2fb23-8c03-4187-a3ba-8b7c919e889", result['uuid']) - self.assertEqual([], result['requirements']) - self.assertEqual("much server", result['tags'][0]) - self.assertEqual(1, result['smp']) + self.assertEqual("65b2fb23-8c03-4187-a3ba-8b7c919e889", result["uuid"]) + self.assertEqual([], result["requirements"]) + self.assertEqual("much server", result["tags"][0]) + self.assertEqual(1, result["smp"]) def test_len(self): self.assertEqual(len(SERVER_CONTEXT), len(self.c.all())) def test_contains(self): result = self.c.all() - self.assertTrue('uuid' in result) - self.assertFalse('uid' in result) - self.assertTrue('meta' in result) - self.assertFalse('ssh_public_key' in result) + self.assertTrue("uuid" in result) + self.assertFalse("uid" in result) + self.assertTrue("meta" in result) + self.assertFalse("ssh_public_key" in result) def test_iter(self): - self.assertEqual(sorted(SERVER_CONTEXT.keys()), - sorted([key for key in self.c.all()])) + self.assertEqual( + sorted(SERVER_CONTEXT.keys()), + sorted([key for key in self.c.all()]), + ) def test_with_list_as_result(self): - result = self.c.get('tags') - self.assertEqual('much server', result[0]) - self.assertTrue('very performance' in result) + result = self.c.get("tags") + self.assertEqual("much server", result[0]) + self.assertTrue("very performance" in result) self.assertEqual(2, len(result)) + # vi: ts=4 expandtab |