summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/__init__.py0
-rw-r--r--tests/unittests/__init__.py0
-rw-r--r--tests/unittests/test_datasource/__init__.py0
-rw-r--r--tests/unittests/test_distros/__init__.py0
-rw-r--r--tests/unittests/test_filters/__init__.py0
-rw-r--r--tests/unittests/test_filters/test_launch_index.py10
-rw-r--r--tests/unittests/test_handler/__init__.py0
-rw-r--r--tests/unittests/test_handler/test_handler_ca_certs.py18
-rw-r--r--tests/unittests/test_runs/__init__.py0
-rw-r--r--tests/unittests/test_runs/test_simple_run.py10
10 files changed, 11 insertions, 27 deletions
diff --git a/tests/__init__.py b/tests/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/__init__.py
diff --git a/tests/unittests/__init__.py b/tests/unittests/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/unittests/__init__.py
diff --git a/tests/unittests/test_datasource/__init__.py b/tests/unittests/test_datasource/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/unittests/test_datasource/__init__.py
diff --git a/tests/unittests/test_distros/__init__.py b/tests/unittests/test_distros/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/unittests/test_distros/__init__.py
diff --git a/tests/unittests/test_filters/__init__.py b/tests/unittests/test_filters/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/unittests/test_filters/__init__.py
diff --git a/tests/unittests/test_filters/test_launch_index.py b/tests/unittests/test_filters/test_launch_index.py
index 1e9b9053..773bb312 100644
--- a/tests/unittests/test_filters/test_launch_index.py
+++ b/tests/unittests/test_filters/test_launch_index.py
@@ -1,14 +1,6 @@
import copy
-import os
-import sys
-top_dir = os.path.join(os.path.dirname(__file__), os.pardir, "helpers.py")
-top_dir = os.path.abspath(top_dir)
-if os.path.exists(top_dir):
- sys.path.insert(0, os.path.dirname(top_dir))
-
-
-import helpers
+from tests.unittests import helpers
import itertools
diff --git a/tests/unittests/test_handler/__init__.py b/tests/unittests/test_handler/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/unittests/test_handler/__init__.py
diff --git a/tests/unittests/test_handler/test_handler_ca_certs.py b/tests/unittests/test_handler/test_handler_ca_certs.py
index d3df5c50..d73c9fa9 100644
--- a/tests/unittests/test_handler/test_handler_ca_certs.py
+++ b/tests/unittests/test_handler/test_handler_ca_certs.py
@@ -77,7 +77,7 @@ class TestConfig(MockerTestCase):
"""Test that a single cert gets passed to add_ca_certs."""
config = {"ca-certs": {"trusted": ["CERT1"]}}
- self.mock_add(self.paths, ["CERT1"])
+ self.mock_add(["CERT1"])
self.mock_update()
self.mocker.replay()
@@ -87,7 +87,7 @@ class TestConfig(MockerTestCase):
"""Test that multiple certs get passed to add_ca_certs."""
config = {"ca-certs": {"trusted": ["CERT1", "CERT2"]}}
- self.mock_add(self.paths, ["CERT1", "CERT2"])
+ self.mock_add(["CERT1", "CERT2"])
self.mock_update()
self.mocker.replay()
@@ -97,7 +97,7 @@ class TestConfig(MockerTestCase):
"""Test remove_defaults works as expected."""
config = {"ca-certs": {"remove-defaults": True}}
- self.mock_remove(self.paths)
+ self.mock_remove()
self.mock_update()
self.mocker.replay()
@@ -116,8 +116,8 @@ class TestConfig(MockerTestCase):
"""Test remove_defaults is not called when config value is False."""
config = {"ca-certs": {"remove-defaults": True, "trusted": ["CERT1"]}}
- self.mock_remove(self.paths)
- self.mock_add(self.paths, ["CERT1"])
+ self.mock_remove()
+ self.mock_add(["CERT1"])
self.mock_update()
self.mocker.replay()
@@ -136,7 +136,7 @@ class TestAddCaCerts(MockerTestCase):
"""Test that no certificate are written if not provided."""
self.mocker.replace(util.write_file, passthrough=False)
self.mocker.replay()
- cc_ca_certs.add_ca_certs(self.paths, [])
+ cc_ca_certs.add_ca_certs([])
def test_single_cert(self):
"""Test adding a single certificate to the trusted CAs."""
@@ -149,7 +149,7 @@ class TestAddCaCerts(MockerTestCase):
"\ncloud-init-ca-certs.crt", omode="ab")
self.mocker.replay()
- cc_ca_certs.add_ca_certs(self.paths, [cert])
+ cc_ca_certs.add_ca_certs([cert])
def test_multiple_certs(self):
"""Test adding multiple certificates to the trusted CAs."""
@@ -163,7 +163,7 @@ class TestAddCaCerts(MockerTestCase):
"\ncloud-init-ca-certs.crt", omode="ab")
self.mocker.replay()
- cc_ca_certs.add_ca_certs(self.paths, certs)
+ cc_ca_certs.add_ca_certs(certs)
class TestUpdateCaCerts(MockerTestCase):
@@ -198,4 +198,4 @@ class TestRemoveDefaultCaCerts(MockerTestCase):
"ca-certificates ca-certificates/trust_new_crts select no")
self.mocker.replay()
- cc_ca_certs.remove_default_ca_certs(self.paths)
+ cc_ca_certs.remove_default_ca_certs()
diff --git a/tests/unittests/test_runs/__init__.py b/tests/unittests/test_runs/__init__.py
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/unittests/test_runs/__init__.py
diff --git a/tests/unittests/test_runs/test_simple_run.py b/tests/unittests/test_runs/test_simple_run.py
index 1e852e1e..22d6cf2c 100644
--- a/tests/unittests/test_runs/test_simple_run.py
+++ b/tests/unittests/test_runs/test_simple_run.py
@@ -1,14 +1,6 @@
import os
-import sys
-# Allow running this test individually
-top_dir = os.path.join(os.path.dirname(__file__), os.pardir, "helpers.py")
-top_dir = os.path.abspath(top_dir)
-if os.path.exists(top_dir):
- sys.path.insert(0, os.path.dirname(top_dir))
-
-
-import helpers
+from tests.unittests import helpers
from cloudinit.settings import (PER_INSTANCE)
from cloudinit import stages