summaryrefslogtreecommitdiff
path: root/tests/unittests/test_datasource
diff options
context:
space:
mode:
authorScott Moser <smoser@brickies.net>2017-01-20 10:06:55 -0500
committerScott Moser <smoser@brickies.net>2017-01-20 10:06:55 -0500
commitd00b7dba8767618ae360f56bf64b7ab7a8c49d2e (patch)
tree349799f76c39669a03a6acbd48502970c0abb994 /tests/unittests/test_datasource
parentfa3009b64949fef3744ddb940f01477dfa2d25e5 (diff)
parent7fb6f78177b5ece10ca7c54ba3958010a9987f06 (diff)
downloadvyos-cloud-init-d00b7dba8767618ae360f56bf64b7ab7a8c49d2e.tar.gz
vyos-cloud-init-d00b7dba8767618ae360f56bf64b7ab7a8c49d2e.zip
merge from 0.7.9 at 0.7.9
Diffstat (limited to 'tests/unittests/test_datasource')
-rw-r--r--tests/unittests/test_datasource/test_aliyun.py4
-rw-r--r--tests/unittests/test_datasource/test_altcloud.py24
-rw-r--r--tests/unittests/test_datasource/test_azure.py44
-rw-r--r--tests/unittests/test_datasource/test_azure_helper.py4
-rw-r--r--tests/unittests/test_datasource/test_cloudsigma.py22
-rw-r--r--tests/unittests/test_datasource/test_cloudstack.py4
-rw-r--r--tests/unittests/test_datasource/test_common.py75
-rw-r--r--tests/unittests/test_datasource/test_configdrive.py2
-rw-r--r--tests/unittests/test_datasource/test_digitalocean.py19
-rw-r--r--tests/unittests/test_datasource/test_gce.py19
-rw-r--r--tests/unittests/test_datasource/test_maas.py2
-rw-r--r--tests/unittests/test_datasource/test_nocloud.py2
-rw-r--r--tests/unittests/test_datasource/test_opennebula.py2
-rw-r--r--tests/unittests/test_datasource/test_openstack.py20
-rw-r--r--tests/unittests/test_datasource/test_ovf.py20
-rw-r--r--tests/unittests/test_datasource/test_smartos.py33
16 files changed, 184 insertions, 112 deletions
diff --git a/tests/unittests/test_datasource/test_aliyun.py b/tests/unittests/test_datasource/test_aliyun.py
index 6f1de072..c16d1a6e 100644
--- a/tests/unittests/test_datasource/test_aliyun.py
+++ b/tests/unittests/test_datasource/test_aliyun.py
@@ -1,3 +1,5 @@
+# This file is part of cloud-init. See LICENSE file for license information.
+
import functools
import httpretty
import os
@@ -146,3 +148,5 @@ class TestAliYunDatasource(test_helpers.HttprettyTestCase):
'ssh-key-1']}}
self.assertEqual(ay.parse_public_keys(public_keys),
public_keys['key-pair-0']['openssh-key'])
+
+# vi: ts=4 expandtab
diff --git a/tests/unittests/test_datasource/test_altcloud.py b/tests/unittests/test_datasource/test_altcloud.py
index 12966563..b0ad86ab 100644
--- a/tests/unittests/test_datasource/test_altcloud.py
+++ b/tests/unittests/test_datasource/test_altcloud.py
@@ -1,22 +1,11 @@
-# vi: ts=4 expandtab
-#
-# Copyright (C) 2009-2010 Canonical Ltd.
-# Copyright (C) 2012 Hewlett-Packard Development Company, L.P.
-# Copyright (C) 2012 Yahoo! Inc.
-#
-# Author: Joe VLcek <JVLcek@RedHat.com>
+# Copyright (C) 2009-2010 Canonical Ltd.
+# Copyright (C) 2012 Hewlett-Packard Development Company, L.P.
+# Copyright (C) 2012 Yahoo! Inc.
#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License version 3, as
-# published by the Free Software Foundation.
+# Author: Joe VLcek <JVLcek@RedHat.com>
#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
+# This file is part of cloud-init. See LICENSE file for license information.
+
'''
This test file exercises the code in sources DataSourceAltCloud.py
'''
@@ -448,5 +437,4 @@ def force_arch(arch=None):
elif arch is None:
setattr(os, 'uname', OS_UNAME_ORIG)
-
# vi: ts=4 expandtab
diff --git a/tests/unittests/test_datasource/test_azure.py b/tests/unittests/test_datasource/test_azure.py
index 07127008..8d22bb59 100644
--- a/tests/unittests/test_datasource/test_azure.py
+++ b/tests/unittests/test_datasource/test_azure.py
@@ -1,3 +1,5 @@
+# This file is part of cloud-init. See LICENSE file for license information.
+
from cloudinit import helpers
from cloudinit.util import b64e, decode_binary, load_file
from cloudinit.sources import DataSourceAzure
@@ -93,7 +95,7 @@ class TestAzureDataSource(TestCase):
for module, name, new in patches:
self.patches.enter_context(mock.patch.object(module, name, new))
- def _get_ds(self, data):
+ def _get_ds(self, data, agent_command=None):
def dsdevs():
return data.get('dsdevs', [])
@@ -137,6 +139,8 @@ class TestAzureDataSource(TestCase):
dsrc = mod.DataSourceAzureNet(
data.get('sys_cfg', {}), distro=None, paths=self.paths)
+ if agent_command is not None:
+ dsrc.ds_cfg['agent_command'] = agent_command
return dsrc
@@ -299,7 +303,7 @@ class TestAzureDataSource(TestCase):
data = {'ovfcontent': construct_valid_ovf_env(data=odata,
pubkeys=pubkeys)}
- dsrc = self._get_ds(data)
+ dsrc = self._get_ds(data, agent_command=['not', '__builtin__'])
ret = dsrc.get_data()
self.assertTrue(ret)
for mypk in mypklist:
@@ -314,7 +318,7 @@ class TestAzureDataSource(TestCase):
data = {'ovfcontent': construct_valid_ovf_env(data=odata,
pubkeys=pubkeys)}
- dsrc = self._get_ds(data)
+ dsrc = self._get_ds(data, agent_command=['not', '__builtin__'])
ret = dsrc.get_data()
self.assertTrue(ret)
@@ -330,7 +334,7 @@ class TestAzureDataSource(TestCase):
data = {'ovfcontent': construct_valid_ovf_env(data=odata,
pubkeys=pubkeys)}
- dsrc = self._get_ds(data)
+ dsrc = self._get_ds(data, agent_command=['not', '__builtin__'])
ret = dsrc.get_data()
self.assertTrue(ret)
@@ -487,12 +491,15 @@ class TestAzureBounce(TestCase):
def tearDown(self):
self.patches.close()
- def _get_ds(self, ovfcontent=None):
+ def _get_ds(self, ovfcontent=None, agent_command=None):
if ovfcontent is not None:
populate_dir(os.path.join(self.paths.seed_dir, "azure"),
{'ovf-env.xml': ovfcontent})
- return DataSourceAzure.DataSourceAzureNet(
+ dsrc = DataSourceAzure.DataSourceAzureNet(
{}, distro=None, paths=self.paths)
+ if agent_command is not None:
+ dsrc.ds_cfg['agent_command'] = agent_command
+ return dsrc
def get_ovf_env_with_dscfg(self, hostname, cfg):
odata = {
@@ -537,14 +544,17 @@ class TestAzureBounce(TestCase):
host_name = 'unchanged-host-name'
self.get_hostname.return_value = host_name
cfg = {'hostname_bounce': {'policy': 'force'}}
- self._get_ds(self.get_ovf_env_with_dscfg(host_name, cfg)).get_data()
+ self._get_ds(self.get_ovf_env_with_dscfg(host_name, cfg),
+ agent_command=['not', '__builtin__']).get_data()
self.assertEqual(1, perform_hostname_bounce.call_count)
def test_different_hostnames_sets_hostname(self):
expected_hostname = 'azure-expected-host-name'
self.get_hostname.return_value = 'default-host-name'
self._get_ds(
- self.get_ovf_env_with_dscfg(expected_hostname, {})).get_data()
+ self.get_ovf_env_with_dscfg(expected_hostname, {}),
+ agent_command=['not', '__builtin__'],
+ ).get_data()
self.assertEqual(expected_hostname,
self.set_hostname.call_args_list[0][0][0])
@@ -554,14 +564,18 @@ class TestAzureBounce(TestCase):
expected_hostname = 'azure-expected-host-name'
self.get_hostname.return_value = 'default-host-name'
self._get_ds(
- self.get_ovf_env_with_dscfg(expected_hostname, {})).get_data()
+ self.get_ovf_env_with_dscfg(expected_hostname, {}),
+ agent_command=['not', '__builtin__'],
+ ).get_data()
self.assertEqual(1, perform_hostname_bounce.call_count)
def test_different_hostnames_sets_hostname_back(self):
initial_host_name = 'default-host-name'
self.get_hostname.return_value = initial_host_name
self._get_ds(
- self.get_ovf_env_with_dscfg('some-host-name', {})).get_data()
+ self.get_ovf_env_with_dscfg('some-host-name', {}),
+ agent_command=['not', '__builtin__'],
+ ).get_data()
self.assertEqual(initial_host_name,
self.set_hostname.call_args_list[-1][0][0])
@@ -572,7 +586,9 @@ class TestAzureBounce(TestCase):
initial_host_name = 'default-host-name'
self.get_hostname.return_value = initial_host_name
self._get_ds(
- self.get_ovf_env_with_dscfg('some-host-name', {})).get_data()
+ self.get_ovf_env_with_dscfg('some-host-name', {}),
+ agent_command=['not', '__builtin__'],
+ ).get_data()
self.assertEqual(initial_host_name,
self.set_hostname.call_args_list[-1][0][0])
@@ -583,7 +599,7 @@ class TestAzureBounce(TestCase):
self.get_hostname.return_value = old_hostname
cfg = {'hostname_bounce': {'interface': interface, 'policy': 'force'}}
data = self.get_ovf_env_with_dscfg(hostname, cfg)
- self._get_ds(data).get_data()
+ self._get_ds(data, agent_command=['not', '__builtin__']).get_data()
self.assertEqual(1, self.subp.call_count)
bounce_env = self.subp.call_args[1]['env']
self.assertEqual(interface, bounce_env['interface'])
@@ -595,7 +611,7 @@ class TestAzureBounce(TestCase):
DataSourceAzure.BUILTIN_DS_CONFIG['hostname_bounce']['command'] = cmd
cfg = {'hostname_bounce': {'policy': 'force'}}
data = self.get_ovf_env_with_dscfg('some-hostname', cfg)
- self._get_ds(data).get_data()
+ self._get_ds(data, agent_command=['not', '__builtin__']).get_data()
self.assertEqual(1, self.subp.call_count)
bounce_args = self.subp.call_args[1]['args']
self.assertEqual(cmd, bounce_args)
@@ -630,3 +646,5 @@ class TestReadAzureOvf(TestCase):
(_md, _ud, cfg) = DataSourceAzure.read_azure_ovf(content)
for mypk in mypklist:
self.assertIn(mypk, cfg['_pubkeys'])
+
+# vi: ts=4 expandtab
diff --git a/tests/unittests/test_datasource/test_azure_helper.py b/tests/unittests/test_datasource/test_azure_helper.py
index 64523e16..aafdebd7 100644
--- a/tests/unittests/test_datasource/test_azure_helper.py
+++ b/tests/unittests/test_datasource/test_azure_helper.py
@@ -1,3 +1,5 @@
+# This file is part of cloud-init. See LICENSE file for license information.
+
import os
from cloudinit.sources.helpers import azure as azure_helper
@@ -419,3 +421,5 @@ class TestGetMetadataFromFabric(TestCase):
self.assertRaises(SentinelException,
azure_helper.get_metadata_from_fabric)
self.assertEqual(1, shim.return_value.clean_up.call_count)
+
+# vi: ts=4 expandtab
diff --git a/tests/unittests/test_datasource/test_cloudsigma.py b/tests/unittests/test_datasource/test_cloudsigma.py
index 2a42ce0c..5997102c 100644
--- a/tests/unittests/test_datasource/test_cloudsigma.py
+++ b/tests/unittests/test_datasource/test_cloudsigma.py
@@ -1,8 +1,9 @@
-# coding: utf-8
+# This file is part of cloud-init. See LICENSE file for license information.
import copy
from cloudinit.cs_utils import Cepko
+from cloudinit import sources
from cloudinit.sources import DataSourceCloudSigma
from .. import helpers as test_helpers
@@ -49,7 +50,8 @@ class DataSourceCloudSigmaTest(test_helpers.TestCase):
self.assertEqual("test_server", self.datasource.get_hostname())
self.datasource.metadata['name'] = ''
self.assertEqual("65b2fb23", self.datasource.get_hostname())
- self.datasource.metadata['name'] = u'ั‚ะตัั‚'
+ utf8_hostname = b'\xd1\x82\xd0\xb5\xd1\x81\xd1\x82'.decode('utf-8')
+ self.datasource.metadata['name'] = utf8_hostname
self.assertEqual("65b2fb23", self.datasource.get_hostname())
def test_get_public_ssh_keys(self):
@@ -97,3 +99,19 @@ class DataSourceCloudSigmaTest(test_helpers.TestCase):
self.datasource.get_data()
self.assertIsNone(self.datasource.vendordata_raw)
+
+
+class DsLoads(test_helpers.TestCase):
+ def test_get_datasource_list_returns_in_local(self):
+ deps = (sources.DEP_FILESYSTEM,)
+ ds_list = DataSourceCloudSigma.get_datasource_list(deps)
+ self.assertEqual(ds_list,
+ [DataSourceCloudSigma.DataSourceCloudSigma])
+
+ def test_list_sources_finds_ds(self):
+ found = sources.list_sources(
+ ['CloudSigma'], (sources.DEP_FILESYSTEM,), ['cloudinit.sources'])
+ self.assertEqual([DataSourceCloudSigma.DataSourceCloudSigma],
+ found)
+
+# vi: ts=4 expandtab
diff --git a/tests/unittests/test_datasource/test_cloudstack.py b/tests/unittests/test_datasource/test_cloudstack.py
index b1aab17b..e93d28de 100644
--- a/tests/unittests/test_datasource/test_cloudstack.py
+++ b/tests/unittests/test_datasource/test_cloudstack.py
@@ -1,3 +1,5 @@
+# This file is part of cloud-init. See LICENSE file for license information.
+
from cloudinit import helpers
from cloudinit.sources.DataSourceCloudStack import DataSourceCloudStack
@@ -76,3 +78,5 @@ class TestCloudStackPasswordFetching(TestCase):
def test_password_not_saved_if_bad_request(self):
self._check_password_not_saved_for('bad_request')
+
+# vi: ts=4 expandtab
diff --git a/tests/unittests/test_datasource/test_common.py b/tests/unittests/test_datasource/test_common.py
new file mode 100644
index 00000000..c08717f3
--- /dev/null
+++ b/tests/unittests/test_datasource/test_common.py
@@ -0,0 +1,75 @@
+# This file is part of cloud-init. See LICENSE file for license information.
+
+from cloudinit import settings
+from cloudinit import sources
+from cloudinit import type_utils
+from cloudinit.sources import (
+ DataSourceAliYun as AliYun,
+ DataSourceAltCloud as AltCloud,
+ DataSourceAzure as Azure,
+ DataSourceBigstep as Bigstep,
+ DataSourceCloudSigma as CloudSigma,
+ DataSourceCloudStack as CloudStack,
+ DataSourceConfigDrive as ConfigDrive,
+ DataSourceDigitalOcean as DigitalOcean,
+ DataSourceEc2 as Ec2,
+ DataSourceGCE as GCE,
+ DataSourceMAAS as MAAS,
+ DataSourceNoCloud as NoCloud,
+ DataSourceOpenNebula as OpenNebula,
+ DataSourceOpenStack as OpenStack,
+ DataSourceOVF as OVF,
+ DataSourceSmartOS as SmartOS,
+)
+from cloudinit.sources import DataSourceNone as DSNone
+
+from .. import helpers as test_helpers
+
+DEFAULT_LOCAL = [
+ CloudSigma.DataSourceCloudSigma,
+ ConfigDrive.DataSourceConfigDrive,
+ DigitalOcean.DataSourceDigitalOcean,
+ NoCloud.DataSourceNoCloud,
+ OpenNebula.DataSourceOpenNebula,
+ OVF.DataSourceOVF,
+ SmartOS.DataSourceSmartOS,
+]
+
+DEFAULT_NETWORK = [
+ AltCloud.DataSourceAltCloud,
+ Azure.DataSourceAzureNet,
+ Bigstep.DataSourceBigstep,
+ CloudStack.DataSourceCloudStack,
+ DSNone.DataSourceNone,
+ Ec2.DataSourceEc2,
+ GCE.DataSourceGCE,
+ MAAS.DataSourceMAAS,
+ NoCloud.DataSourceNoCloudNet,
+ OpenStack.DataSourceOpenStack,
+ OVF.DataSourceOVFNet,
+]
+
+
+class ExpectedDataSources(test_helpers.TestCase):
+ builtin_list = settings.CFG_BUILTIN['datasource_list']
+ deps_local = [sources.DEP_FILESYSTEM]
+ deps_network = [sources.DEP_FILESYSTEM, sources.DEP_NETWORK]
+ pkg_list = [type_utils.obj_name(sources)]
+
+ def test_expected_default_local_sources_found(self):
+ found = sources.list_sources(
+ self.builtin_list, self.deps_local, self.pkg_list)
+ self.assertEqual(set(DEFAULT_LOCAL), set(found))
+
+ def test_expected_default_network_sources_found(self):
+ found = sources.list_sources(
+ self.builtin_list, self.deps_network, self.pkg_list)
+ self.assertEqual(set(DEFAULT_NETWORK), set(found))
+
+ def test_expected_nondefault_network_sources_found(self):
+ found = sources.list_sources(
+ ['AliYun'], self.deps_network, self.pkg_list)
+ self.assertEqual(set([AliYun.DataSourceAliYun]), set(found))
+
+
+# vi: ts=4 expandtab
diff --git a/tests/unittests/test_datasource/test_configdrive.py b/tests/unittests/test_datasource/test_configdrive.py
index 6e00abf4..55153357 100644
--- a/tests/unittests/test_datasource/test_configdrive.py
+++ b/tests/unittests/test_datasource/test_configdrive.py
@@ -1,3 +1,5 @@
+# This file is part of cloud-init. See LICENSE file for license information.
+
from copy import copy, deepcopy
import json
import os
diff --git a/tests/unittests/test_datasource/test_digitalocean.py b/tests/unittests/test_datasource/test_digitalocean.py
index 7bde0820..9be6bc19 100644
--- a/tests/unittests/test_datasource/test_digitalocean.py
+++ b/tests/unittests/test_datasource/test_digitalocean.py
@@ -1,19 +1,8 @@
+# Copyright (C) 2014 Neal Shrader
#
-# Copyright (C) 2014 Neal Shrader
+# Author: Neal Shrader <neal@digitalocean.com>
#
-# Author: Neal Shrader <neal@digitalocean.com>
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License version 3, as
-# published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
+# This file is part of cloud-init. See LICENSE file for license information.
import json
@@ -330,3 +319,5 @@ class TestNetworkConvert(TestCase):
self.assertEqual(
sorted(['45.55.249.133', '10.17.0.5']),
sorted([i['address'] for i in eth0['subnets']]))
+
+# vi: ts=4 expandtab
diff --git a/tests/unittests/test_datasource/test_gce.py b/tests/unittests/test_datasource/test_gce.py
index 6e62a4d2..4f667678 100644
--- a/tests/unittests/test_datasource/test_gce.py
+++ b/tests/unittests/test_datasource/test_gce.py
@@ -1,19 +1,8 @@
+# Copyright (C) 2014 Vaidas Jablonskis
#
-# Copyright (C) 2014 Vaidas Jablonskis
+# Author: Vaidas Jablonskis <jablonskis@gmail.com>
#
-# Author: Vaidas Jablonskis <jablonskis@gmail.com>
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License version 3, as
-# published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
+# This file is part of cloud-init. See LICENSE file for license information.
import re
@@ -164,3 +153,5 @@ class TestDataSourceGCE(test_helpers.HttprettyTestCase):
_set_mock_metadata()
self.ds.get_data()
self.assertEqual('bar', self.ds.availability_zone)
+
+# vi: ts=4 expandtab
diff --git a/tests/unittests/test_datasource/test_maas.py b/tests/unittests/test_datasource/test_maas.py
index 0126c883..693882d2 100644
--- a/tests/unittests/test_datasource/test_maas.py
+++ b/tests/unittests/test_datasource/test_maas.py
@@ -1,3 +1,5 @@
+# This file is part of cloud-init. See LICENSE file for license information.
+
from copy import copy
import os
import shutil
diff --git a/tests/unittests/test_datasource/test_nocloud.py b/tests/unittests/test_datasource/test_nocloud.py
index f6a46ce9..ff294395 100644
--- a/tests/unittests/test_datasource/test_nocloud.py
+++ b/tests/unittests/test_datasource/test_nocloud.py
@@ -1,3 +1,5 @@
+# This file is part of cloud-init. See LICENSE file for license information.
+
from cloudinit import helpers
from cloudinit.sources import DataSourceNoCloud
from cloudinit import util
diff --git a/tests/unittests/test_datasource/test_opennebula.py b/tests/unittests/test_datasource/test_opennebula.py
index ce5b5550..a266e952 100644
--- a/tests/unittests/test_datasource/test_opennebula.py
+++ b/tests/unittests/test_datasource/test_opennebula.py
@@ -1,3 +1,5 @@
+# This file is part of cloud-init. See LICENSE file for license information.
+
from cloudinit import helpers
from cloudinit.sources import DataSourceOpenNebula as ds
from cloudinit import util
diff --git a/tests/unittests/test_datasource/test_openstack.py b/tests/unittests/test_datasource/test_openstack.py
index 125c6d6e..e5b6fcc6 100644
--- a/tests/unittests/test_datasource/test_openstack.py
+++ b/tests/unittests/test_datasource/test_openstack.py
@@ -1,20 +1,8 @@
-# vi: ts=4 expandtab
-#
-# Copyright (C) 2014 Yahoo! Inc.
-#
-# Author: Joshua Harlow <harlowja@yahoo-inc.com>
+# Copyright (C) 2014 Yahoo! Inc.
#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License version 3, as
-# published by the Free Software Foundation.
+# Author: Joshua Harlow <harlowja@yahoo-inc.com>
#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
+# This file is part of cloud-init. See LICENSE file for license information.
import copy
import json
@@ -344,3 +332,5 @@ class TestVendorDataLoading(test_helpers.TestCase):
def test_vd_load_dict_ci_list(self):
data = {'foo': 'bar', 'cloud-init': ['VD_1', 'VD_2']}
self.assertEqual(self.cvj(data), data['cloud-init'])
+
+# vi: ts=4 expandtab
diff --git a/tests/unittests/test_datasource/test_ovf.py b/tests/unittests/test_datasource/test_ovf.py
index 5f8e7e44..3e09510c 100644
--- a/tests/unittests/test_datasource/test_ovf.py
+++ b/tests/unittests/test_datasource/test_ovf.py
@@ -1,20 +1,8 @@
-# vi: ts=4 expandtab
-#
-# Copyright (C) 2016 Canonical Ltd.
-#
-# Author: Scott Moser <scott.moser@canonical.com>
+# Copyright (C) 2016 Canonical Ltd.
#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License version 3, as
-# published by the Free Software Foundation.
+# Author: Scott Moser <scott.moser@canonical.com>
#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
+# This file is part of cloud-init. See LICENSE file for license information.
import base64
@@ -81,3 +69,5 @@ class TestReadOvfEnv(test_helpers.TestCase):
self.assertEqual({"instance-id": "inst-001"}, md)
self.assertEqual({'password': "passw0rd"}, cfg)
self.assertEqual(None, ud)
+
+# vi: ts=4 expandtab
diff --git a/tests/unittests/test_datasource/test_smartos.py b/tests/unittests/test_datasource/test_smartos.py
index 0532f986..e3c99bbb 100644
--- a/tests/unittests/test_datasource/test_smartos.py
+++ b/tests/unittests/test_datasource/test_smartos.py
@@ -1,26 +1,15 @@
-# vi: ts=4 expandtab
-#
-# Copyright (C) 2013 Canonical Ltd.
-#
-# Author: Ben Howard <ben.howard@canonical.com>
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License version 3, as
-# published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
+# Copyright (C) 2013 Canonical Ltd.
#
+# Author: Ben Howard <ben.howard@canonical.com>
#
-# This is a testcase for the SmartOS datasource. It replicates a serial
-# console and acts like the SmartOS console does in order to validate
-# return responses.
-#
+# This file is part of cloud-init. See LICENSE file for license information.
+
+'''This is a testcase for the SmartOS datasource.
+
+It replicates a serial console and acts like the SmartOS console does in
+order to validate return responses.
+
+'''
from __future__ import print_function
@@ -881,3 +870,5 @@ class TestNetworkConversion(TestCase):
'type': 'static'}]}]}
found = convert_net(SDC_NICS_SINGLE_GATEWAY)
self.assertEqual(expected, found)
+
+# vi: ts=4 expandtab