summaryrefslogtreecommitdiff
path: root/tests/unittests/test_cs_util.py
diff options
context:
space:
mode:
authorJoshua Harlow <harlowja@gmail.com>2016-05-11 14:18:02 -0700
committerJoshua Harlow <harlowja@gmail.com>2016-05-11 14:18:02 -0700
commit26ea813d293467921ab6b1e32abd2ab8fcefa3bd (patch)
treebd641e5867bdd96effa33d62e5c200b5dd7e6331 /tests/unittests/test_cs_util.py
parent67e506a50dae2b0c1a806f482670b864e84809ae (diff)
downloadvyos-cloud-init-26ea813d293467921ab6b1e32abd2ab8fcefa3bd.tar.gz
vyos-cloud-init-26ea813d293467921ab6b1e32abd2ab8fcefa3bd.zip
Fix py26 for rhel (and older versions of python)
Diffstat (limited to 'tests/unittests/test_cs_util.py')
-rw-r--r--tests/unittests/test_cs_util.py42
1 files changed, 14 insertions, 28 deletions
diff --git a/tests/unittests/test_cs_util.py b/tests/unittests/test_cs_util.py
index d7273035..8c9ac0cd 100644
--- a/tests/unittests/test_cs_util.py
+++ b/tests/unittests/test_cs_util.py
@@ -1,20 +1,14 @@
from __future__ import print_function
-import sys
-import unittest
+from . import helpers as test_helpers
-from cloudinit.cs_utils import Cepko
+import unittest2
try:
- skip = unittest.skip
-except AttributeError:
- # Python 2.6. Doesn't have to be high fidelity.
- def skip(reason):
- def decorator(func):
- def wrapper(*args, **kws):
- print(reason, file=sys.stderr)
- return wrapper
- return decorator
+ from cloudinit.cs_utils import Cepko
+ WILL_WORK = True
+except ImportError:
+ WILL_WORK = False
SERVER_CONTEXT = {
@@ -32,29 +26,21 @@ SERVER_CONTEXT = {
}
-class CepkoMock(Cepko):
- def all(self):
- return SERVER_CONTEXT
+if WILL_WORK:
+ class CepkoMock(Cepko):
+ def all(self):
+ return SERVER_CONTEXT
- def get(self, key="", request_pattern=None):
- return SERVER_CONTEXT['tags']
+ def get(self, key="", request_pattern=None):
+ return SERVER_CONTEXT['tags']
# 2015-01-22 BAW: This test is completely useless because it only ever tests
# the CepkoMock object. Even in its original form, I don't think it ever
# touched the underlying Cepko class methods.
-@skip('This test is completely useless')
-class CepkoResultTests(unittest.TestCase):
+class CepkoResultTests(test_helpers.TestCase):
def setUp(self):
- pass
- # self.mocked = self.mocker.replace("cloudinit.cs_utils.Cepko",
- # spec=CepkoMock,
- # count=False,
- # passthrough=False)
- # self.mocked()
- # self.mocker.result(CepkoMock())
- # self.mocker.replay()
- # self.c = Cepko()
+ raise unittest2.SkipTest('This test is completely useless')
def test_getitem(self):
result = self.c.all()