summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/unittests/test__init__.py10
-rw-r--r--tests/unittests/test_datasource/test_maas.py11
2 files changed, 12 insertions, 9 deletions
diff --git a/tests/unittests/test__init__.py b/tests/unittests/test__init__.py
index 2c0abfbc..b4b20e51 100644
--- a/tests/unittests/test__init__.py
+++ b/tests/unittests/test__init__.py
@@ -195,8 +195,8 @@ class TestCmdlineUrl(MockerTestCase):
mock_readurl = self.mocker.replace(url_helper.readurl,
passthrough=False)
- mock_readurl(url)
- self.mocker.result(url_helper.UrlResponse(200, payload))
+ mock_readurl(url, ARGS, KWARGS)
+ self.mocker.result(util.StringResponse(payload))
self.mocker.replay()
self.assertEqual((key, url, None),
@@ -211,8 +211,8 @@ class TestCmdlineUrl(MockerTestCase):
mock_readurl = self.mocker.replace(url_helper.readurl,
passthrough=False)
- mock_readurl(url)
- self.mocker.result(url_helper.UrlResponse(200, payload))
+ mock_readurl(url, ARGS, KWARGS)
+ self.mocker.result(util.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(url_helper.UrlResponse(400))
+ self.mocker.result(util.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 b56fea82..47f8caa4 100644
--- a/tests/unittests/test_datasource/test_maas.py
+++ b/tests/unittests/test_datasource/test_maas.py
@@ -3,12 +3,13 @@ import os
from cloudinit.sources import DataSourceMAAS
from cloudinit import url_helper
+from cloudinit import util
from tests.unittests.helpers import populate_dir
-from mocker import MockerTestCase
+import mocker
-class TestMAASDataSource(MockerTestCase):
+class TestMAASDataSource(mocker.MockerTestCase):
def setUp(self):
super(TestMAASDataSource, self).setUp()
@@ -115,9 +116,11 @@ class TestMAASDataSource(MockerTestCase):
for key in valid_order:
url = "%s/%s/%s" % (my_seed, my_ver, key)
- mock_request(url, headers=my_headers, timeout=None)
+ mock_request(url, headers=my_headers, timeout=mocker.ANY,
+ data=mocker.ANY, sec_between=mocker.ANY,
+ ssl_details=mocker.ANY, retries=mocker.ANY)
resp = valid.get(key)
- self.mocker.result(url_helper.UrlResponse(200, resp))
+ self.mocker.result(util.StringResponse(resp))
self.mocker.replay()
(userdata, metadata) = DataSourceMAAS.read_maas_seed_url(my_seed,