Fix occasional test failure.
Test failures because we didn't correctly parse query params and test
would fail depending on the dict order which is random (aka if UserData
would be first query parameter).
@@ -1445,9 +1445,15 @@ class EC2MockHttp(MockHttp, unittest.TestCase):
def _ex_user_data_RunInstances(self, method, url, body, headers):
# test_create_node_with_ex_userdata
+ if url.startswith('/'):
+ url = url[1:]
+
+ if url.startswith('?'):
+ url = url[1:]
+
params = parse_qs(url)
- self.assertTrue('UserData' in params)
+ self.assertTrue('UserData' in params, 'UserData not in params, actual params: %s' % (str(params)))
user_data = base64.b64decode(b(params['UserData'][0])).decode('utf-8')
self.assertEqual(user_data, 'foo\nbar\foo')
@@ -2047,6 +2053,7 @@ class OutscaleTests(EC2Tests):
result = self.driver.create_node(name='foo', image=image, size=size,
ex_userdata='foo\nbar\foo')
+ self.assertTrue(result)
class FCUMockHttp(EC2MockHttp):
