summaryrefslogtreecommitdiff
path: root/tests/unittests
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2013-04-25 14:03:16 -0400
committerScott Moser <smoser@ubuntu.com>2013-04-25 14:03:16 -0400
commit4697c1afcc7d05951f4717a83dad01d2360301c6 (patch)
tree6d66840f102c71fb7dbd3eafc044cc5e75531d58 /tests/unittests
parent8e97ca8cfaf75edc0b05b0dc2a2ef35c5c82221b (diff)
parenta69c9c8a35b61f69f6e959448af8d0619989589f (diff)
downloadvyos-cloud-init-4697c1afcc7d05951f4717a83dad01d2360301c6.tar.gz
vyos-cloud-init-4697c1afcc7d05951f4717a83dad01d2360301c6.zip
Fix issue in readurl with requests, support passing through headers_cb
This adds the 'headers_cb' option to pass all the way through to readurl. It also makes requests for user-data not retry (as a 404 indicates "no user-data"). LP: #1172742
Diffstat (limited to 'tests/unittests')
-rw-r--r--tests/unittests/test_datasource/test_maas.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/tests/unittests/test_datasource/test_maas.py b/tests/unittests/test_datasource/test_maas.py
index 47f8caa4..2007a6df 100644
--- a/tests/unittests/test_datasource/test_maas.py
+++ b/tests/unittests/test_datasource/test_maas.py
@@ -116,9 +116,10 @@ class TestMAASDataSource(mocker.MockerTestCase):
for key in valid_order:
url = "%s/%s/%s" % (my_seed, my_ver, key)
- mock_request(url, headers=my_headers, timeout=mocker.ANY,
+ mock_request(url, headers=None, timeout=mocker.ANY,
data=mocker.ANY, sec_between=mocker.ANY,
- ssl_details=mocker.ANY, retries=mocker.ANY)
+ ssl_details=mocker.ANY, retries=mocker.ANY,
+ headers_cb=my_headers_cb)
resp = valid.get(key)
self.mocker.result(util.StringResponse(resp))
self.mocker.replay()