summaryrefslogtreecommitdiff
path: root/tests/unittests
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2014-01-24 22:31:28 -0500
committerScott Moser <smoser@ubuntu.com>2014-01-24 22:31:28 -0500
commit0be4922d92e874b2e3300bdde65829cdb6569524 (patch)
treede85c8d5e002377023668b5b3b8c2525be652389 /tests/unittests
parent15ebe2a01c0bcdaae43054e0e3559871a99f72aa (diff)
downloadvyos-cloud-init-0be4922d92e874b2e3300bdde65829cdb6569524.tar.gz
vyos-cloud-init-0be4922d92e874b2e3300bdde65829cdb6569524.zip
read_file_or_url: raise UrlError with 404 on ENOENT
This makes it easier to call read_file_or_url and handle file or url errors. Now read_file_or_url will raise a UrlError in either case on errors.
Diffstat (limited to 'tests/unittests')
-rw-r--r--tests/unittests/test__init__.py6
-rw-r--r--tests/unittests/test_datasource/test_maas.py2
2 files changed, 4 insertions, 4 deletions
diff --git a/tests/unittests/test__init__.py b/tests/unittests/test__init__.py
index b4b20e51..8c41c1ca 100644
--- a/tests/unittests/test__init__.py
+++ b/tests/unittests/test__init__.py
@@ -196,7 +196,7 @@ class TestCmdlineUrl(MockerTestCase):
mock_readurl = self.mocker.replace(url_helper.readurl,
passthrough=False)
mock_readurl(url, ARGS, KWARGS)
- self.mocker.result(util.StringResponse(payload))
+ self.mocker.result(url_helper.StringResponse(payload))
self.mocker.replay()
self.assertEqual((key, url, None),
@@ -212,7 +212,7 @@ class TestCmdlineUrl(MockerTestCase):
mock_readurl = self.mocker.replace(url_helper.readurl,
passthrough=False)
mock_readurl(url, ARGS, KWARGS)
- self.mocker.result(util.StringResponse(payload))
+ self.mocker.result(url_helper.StringResponse(payload))
self.mocker.replay()
self.assertEqual((key, url, payload),
@@ -225,7 +225,7 @@ class TestCmdlineUrl(MockerTestCase):
cmdline = "ro %s=%s bar=1" % (key, url)
self.mocker.replace(url_helper.readurl, passthrough=False)
- self.mocker.result(util.StringResponse(""))
+ self.mocker.result(url_helper.StringResponse(""))
self.mocker.replay()
self.assertEqual((None, None, None),
diff --git a/tests/unittests/test_datasource/test_maas.py b/tests/unittests/test_datasource/test_maas.py
index ebfb24da..bd5d23fd 100644
--- a/tests/unittests/test_datasource/test_maas.py
+++ b/tests/unittests/test_datasource/test_maas.py
@@ -122,7 +122,7 @@ class TestMAASDataSource(mocker.MockerTestCase):
headers_cb=my_headers_cb,
exception_cb=mocker.ANY)
resp = valid.get(key)
- self.mocker.result(util.StringResponse(resp))
+ self.mocker.result(url_helper.StringResponse(resp))
self.mocker.replay()
(userdata, metadata) = DataSourceMAAS.read_maas_seed_url(my_seed,