diff options
author | Scott Moser <smoser@brickies.net> | 2017-04-03 11:52:06 -0400 |
---|---|---|
committer | Scott Moser <smoser@brickies.net> | 2017-04-03 11:52:06 -0400 |
commit | 3b2e493b51153cd5bc1fa91e6ac52f59d41fe3fb (patch) | |
tree | 678b118605245e5bb1b218565728270702aba5b4 /tests/unittests/test_datasource/test_gce.py | |
parent | e018fa910fdf0dbf3aa22e59e935461babd205c4 (diff) | |
parent | 61eb03fef92f435434d974fb46439189ef0b5f97 (diff) | |
download | vyos-cloud-init-3b2e493b51153cd5bc1fa91e6ac52f59d41fe3fb.tar.gz vyos-cloud-init-3b2e493b51153cd5bc1fa91e6ac52f59d41fe3fb.zip |
merge from master at 0.7.9-90-g61eb03fe
Diffstat (limited to 'tests/unittests/test_datasource/test_gce.py')
-rw-r--r-- | tests/unittests/test_datasource/test_gce.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/unittests/test_datasource/test_gce.py b/tests/unittests/test_datasource/test_gce.py index 4f83454e..3eaa58e3 100644 --- a/tests/unittests/test_datasource/test_gce.py +++ b/tests/unittests/test_datasource/test_gce.py @@ -5,6 +5,7 @@ # This file is part of cloud-init. See LICENSE file for license information. import httpretty +import mock import re from base64 import b64encode, b64decode @@ -71,6 +72,11 @@ class TestDataSourceGCE(test_helpers.HttprettyTestCase): self.ds = DataSourceGCE.DataSourceGCE( settings.CFG_BUILTIN, None, helpers.Paths({})) + self.m_platform_reports_gce = mock.patch( + 'cloudinit.sources.DataSourceGCE.platform_reports_gce', + return_value=True) + self.m_platform_reports_gce.start() + self.addCleanup(self.m_platform_reports_gce.stop) super(TestDataSourceGCE, self).setUp() def test_connection(self): @@ -153,7 +159,13 @@ class TestDataSourceGCE(test_helpers.HttprettyTestCase): def test_only_last_part_of_zone_used_for_availability_zone(self): _set_mock_metadata() - self.ds.get_data() + r = self.ds.get_data() + self.assertEqual(True, r) self.assertEqual('bar', self.ds.availability_zone) + def test_get_data_returns_false_if_not_on_gce(self): + self.m_platform_reports_gce.return_value = False + self.assertEqual(False, self.ds.get_data()) + + # vi: ts=4 expandtab |