Move our TestCase in to the cloudinit.tests package.

Instead of a separate cloudinit.test package.

Change-Id: I6ea05a0f57c93a944f435f306a064d918fd26152
This commit is contained in:
Daniel Watkins 2015-07-03 11:50:47 +01:00
parent a09499fc2c
commit f512e05819
8 changed files with 30 additions and 34 deletions

View File

@ -1,21 +0,0 @@
# Copyright 2015 Canonical Ltd.
# This file is part of cloud-init. See LICENCE file for license information.
#
# vi: ts=4 expandtab
import httpretty
import testtools
class TestCase(testtools.TestCase):
"""Base class for all cloud-init test cases."""
def setUp(self):
super(TestCase, self).setUp()
# Do not allow any unknown network connections to get triggered...
httpretty.HTTPretty.allow_net_connect = False
def tearDown(self):
super(TestCase, self).tearDown()
# Ok allow it again....
httpretty.HTTPretty.allow_net_connect = True

View File

@ -2,3 +2,20 @@
# This file is part of cloud-init. See LICENCE file for license information.
#
# vi: ts=4 expandtab
import httpretty
import testtools
class TestCase(testtools.TestCase):
"""Base class for all cloud-init test cases."""
def setUp(self):
super(TestCase, self).setUp()
# Do not allow any unknown network connections to get triggered...
httpretty.HTTPretty.allow_net_connect = False
def tearDown(self):
super(TestCase, self).tearDown()
# Ok allow it again....
httpretty.HTTPretty.allow_net_connect = True

View File

@ -7,12 +7,12 @@ import importlib
import subprocess
from cloudinit import exceptions
from cloudinit import test
from cloudinit import tests
from cloudinit.tests.util import LogSnatcher
from cloudinit.tests.util import mock
class TestNetworkWindows(test.TestCase):
class TestNetworkWindows(tests.TestCase):
def setUp(self):
super(TestNetworkWindows, self).setUp()

View File

@ -5,12 +5,12 @@
from cloudinit.sources import base as base_source
from cloudinit.sources.openstack import base
from cloudinit import test
from cloudinit import tests
from cloudinit.tests.util import LogSnatcher
from cloudinit.tests.util import mock
class TestBaseOpenStackSource(test.TestCase):
class TestBaseOpenStackSource(tests.TestCase):
@mock.patch('cloudinit.sources.openstack.base.BaseOpenStackSource.'
'__abstractmethods__', new=())

View File

@ -10,13 +10,13 @@ from six.moves import http_client
from cloudinit import exceptions
from cloudinit.sources import base
from cloudinit.sources.openstack import httpopenstack
from cloudinit import test
from cloudinit import tests
from cloudinit.tests.util import LogSnatcher
from cloudinit.tests.util import mock
from cloudinit import url_helper
class TestHttpOpenStackSource(test.TestCase):
class TestHttpOpenStackSource(tests.TestCase):
def setUp(self):
self._source = httpopenstack.HttpOpenStackSource()

View File

@ -4,10 +4,10 @@
# vi: ts=4 expandtab
from cloudinit import safeyaml as yaml
from cloudinit import test
from cloudinit import tests
class TestSafeYaml(test.TestCase):
class TestSafeYaml(tests.TestCase):
def test_simple(self):
blob = '\nk1: one\nk2: two'
expected = {'k1': "one", 'k2': "two"}

View File

@ -9,10 +9,10 @@ import os
import textwrap
from cloudinit import templater
from cloudinit import test
from cloudinit import tests
class TestTemplates(test.TestCase):
class TestTemplates(tests.TestCase):
jinja_tmpl = '\n'.join((
"## template:jinja",
"{{a}},{{b}}",

View File

@ -5,7 +5,7 @@
import httpretty
from cloudinit import test
from cloudinit import tests
from cloudinit.tests.util import mock
from cloudinit import url_helper
@ -24,7 +24,7 @@ class TimeJumpSideEffect(object):
return next(self.time)
class UrlHelperWaitForUrlsTest(test.TestCase):
class UrlHelperWaitForUrlsTest(tests.TestCase):
@httpretty.activate
def test_url_wait_for(self):
@ -68,7 +68,7 @@ class UrlHelperWaitForUrlsTest(test.TestCase):
self.assertIsNone(url_helper.wait_any_url(urls, max_wait=1))
class UrlHelperFetchTest(test.TestCase):
class UrlHelperFetchTest(tests.TestCase):
@httpretty.activate
def test_url_fetch(self):