summaryrefslogtreecommitdiff
path: root/tests/unittests/test_builtin_handlers.py
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2016-08-10 09:06:15 -0600
committerScott Moser <smoser@ubuntu.com>2016-08-10 09:06:15 -0600
commitc3c3dc693c14175e110b5fe125d4d5f98ace9700 (patch)
tree8858702c2c8a6ad4bf1bb861a4565e0a9c28e588 /tests/unittests/test_builtin_handlers.py
parent5bd3493d732e5b1902872958e8681f17cbc81ce5 (diff)
downloadcloud-init-trunk.tar.gz
README: Mention move of revision control to git.HEADtrunk
cloud-init development has moved its revision control to git. It is available at https://code.launchpad.net/cloud-init Clone with git clone https://git.launchpad.net/cloud-init or git clone git+ssh://git.launchpad.net/cloud-init For more information see https://git.launchpad.net/cloud-init/tree/HACKING.rst
Diffstat (limited to 'tests/unittests/test_builtin_handlers.py')
-rw-r--r--tests/unittests/test_builtin_handlers.py73
1 files changed, 0 insertions, 73 deletions
diff --git a/tests/unittests/test_builtin_handlers.py b/tests/unittests/test_builtin_handlers.py
deleted file mode 100644
index dea908d7..00000000
--- a/tests/unittests/test_builtin_handlers.py
+++ /dev/null
@@ -1,73 +0,0 @@
-"""Tests of the built-in user data handlers."""
-
-import os
-import shutil
-import tempfile
-
-try:
- from unittest import mock
-except ImportError:
- import mock
-
-from . import helpers as test_helpers
-
-from cloudinit import handlers
-from cloudinit import helpers
-from cloudinit import util
-
-from cloudinit.handlers import upstart_job
-
-from cloudinit.settings import (PER_ALWAYS, PER_INSTANCE)
-
-
-class TestBuiltins(test_helpers.FilesystemMockingTestCase):
- def test_upstart_frequency_no_out(self):
- c_root = tempfile.mkdtemp()
- self.addCleanup(shutil.rmtree, c_root)
- up_root = tempfile.mkdtemp()
- self.addCleanup(shutil.rmtree, up_root)
- paths = helpers.Paths({
- 'cloud_dir': c_root,
- 'upstart_dir': up_root,
- })
- freq = PER_ALWAYS
- h = upstart_job.UpstartJobPartHandler(paths)
- # No files should be written out when
- # the frequency is ! per-instance
- h.handle_part('', handlers.CONTENT_START,
- None, None, None)
- h.handle_part('blah', 'text/upstart-job',
- 'test.conf', 'blah', freq)
- h.handle_part('', handlers.CONTENT_END,
- None, None, None)
- self.assertEqual(0, len(os.listdir(up_root)))
-
- def test_upstart_frequency_single(self):
- # files should be written out when frequency is ! per-instance
- new_root = tempfile.mkdtemp()
- self.addCleanup(shutil.rmtree, new_root)
- freq = PER_INSTANCE
-
- self.patchOS(new_root)
- self.patchUtils(new_root)
- paths = helpers.Paths({
- 'upstart_dir': "/etc/upstart",
- })
-
- upstart_job.SUITABLE_UPSTART = True
- util.ensure_dir("/run")
- util.ensure_dir("/etc/upstart")
-
- with mock.patch.object(util, 'subp') as mockobj:
- h = upstart_job.UpstartJobPartHandler(paths)
- h.handle_part('', handlers.CONTENT_START,
- None, None, None)
- h.handle_part('blah', 'text/upstart-job',
- 'test.conf', 'blah', freq)
- h.handle_part('', handlers.CONTENT_END,
- None, None, None)
-
- self.assertEqual(len(os.listdir('/etc/upstart')), 1)
-
- mockobj.assert_called_once_with(
- ['initctl', 'reload-configuration'], capture=False)