mirror of
https://github.com/valitydev/salt.git
synced 2024-11-06 08:35:21 +00:00
Try giving some rest tornado requests a little more time
This commit is contained in:
parent
80ec40b197
commit
c172470c30
@ -43,7 +43,10 @@ class TestSaltAPIHandler(SaltnadoTestCase):
|
||||
'''
|
||||
Test the root path which returns the list of clients we support
|
||||
'''
|
||||
response = self.fetch('/')
|
||||
response = self.fetch('/',
|
||||
connect_timeout=10,
|
||||
request_timeout=10,
|
||||
)
|
||||
self.assertEqual(response.code, 200)
|
||||
response_obj = json.loads(response.body)
|
||||
self.assertEqual(response_obj['clients'],
|
||||
@ -67,7 +70,9 @@ class TestSaltAPIHandler(SaltnadoTestCase):
|
||||
method='POST',
|
||||
body=json.dumps(low),
|
||||
headers={'Content-Type': self.content_type_map['json']},
|
||||
follow_redirects=False
|
||||
follow_redirects=False,
|
||||
connect_timeout=10,
|
||||
request_timeout=10,
|
||||
)
|
||||
self.assertEqual(response.code, 302)
|
||||
self.assertEqual(response.headers['Location'], '/login')
|
||||
@ -86,6 +91,8 @@ class TestSaltAPIHandler(SaltnadoTestCase):
|
||||
body=json.dumps(low),
|
||||
headers={'Content-Type': self.content_type_map['json'],
|
||||
saltnado.AUTH_TOKEN_HEADER: self.token['token']},
|
||||
connect_timeout=10,
|
||||
request_timeout=10,
|
||||
)
|
||||
response_obj = json.loads(response.body)
|
||||
self.assertEqual(response_obj['return'], [{'minion': True, 'sub_minion': True}])
|
||||
@ -103,6 +110,8 @@ class TestSaltAPIHandler(SaltnadoTestCase):
|
||||
body=json.dumps(low),
|
||||
headers={'Content-Type': self.content_type_map['json'],
|
||||
saltnado.AUTH_TOKEN_HEADER: self.token['token']},
|
||||
connect_timeout=10,
|
||||
request_timeout=10,
|
||||
)
|
||||
response_obj = json.loads(response.body)
|
||||
self.assertEqual(response_obj['return'], ["No minions matched the target. No command was sent, no jid was assigned."])
|
||||
@ -121,6 +130,8 @@ class TestSaltAPIHandler(SaltnadoTestCase):
|
||||
body=json.dumps(low),
|
||||
headers={'Content-Type': self.content_type_map['json'],
|
||||
saltnado.AUTH_TOKEN_HEADER: self.token['token']},
|
||||
connect_timeout=10,
|
||||
request_timeout=10,
|
||||
)
|
||||
response_obj = json.loads(response.body)
|
||||
self.assertEqual(response_obj['return'], [{'minion': True, 'sub_minion': True}])
|
||||
@ -140,6 +151,8 @@ class TestSaltAPIHandler(SaltnadoTestCase):
|
||||
body=json.dumps(low),
|
||||
headers={'Content-Type': self.content_type_map['json'],
|
||||
saltnado.AUTH_TOKEN_HEADER: self.token['token']},
|
||||
connect_timeout=10,
|
||||
request_timeout=10,
|
||||
)
|
||||
response_obj = json.loads(response.body)
|
||||
self.assertEqual(response_obj['return'], [{'minion': True, 'sub_minion': True}])
|
||||
@ -157,6 +170,8 @@ class TestSaltAPIHandler(SaltnadoTestCase):
|
||||
body=json.dumps(low),
|
||||
headers={'Content-Type': self.content_type_map['json'],
|
||||
saltnado.AUTH_TOKEN_HEADER: self.token['token']},
|
||||
connect_timeout=10,
|
||||
request_timeout=10,
|
||||
)
|
||||
response_obj = json.loads(response.body)
|
||||
self.assertEqual(response_obj['return'], [{}])
|
||||
@ -172,6 +187,8 @@ class TestSaltAPIHandler(SaltnadoTestCase):
|
||||
body=json.dumps(low),
|
||||
headers={'Content-Type': self.content_type_map['json'],
|
||||
saltnado.AUTH_TOKEN_HEADER: self.token['token']},
|
||||
connect_timeout=10,
|
||||
request_timeout=10,
|
||||
)
|
||||
response_obj = json.loads(response.body)
|
||||
# TODO: verify pub function? Maybe look at how we test the publisher
|
||||
@ -193,6 +210,8 @@ class TestSaltAPIHandler(SaltnadoTestCase):
|
||||
body=json.dumps(low),
|
||||
headers={'Content-Type': self.content_type_map['json'],
|
||||
saltnado.AUTH_TOKEN_HEADER: self.token['token']},
|
||||
connect_timeout=10,
|
||||
request_timeout=10,
|
||||
)
|
||||
response_obj = json.loads(response.body)
|
||||
self.assertEqual(len(response_obj['return']), 2)
|
||||
@ -222,6 +241,8 @@ class TestSaltAPIHandler(SaltnadoTestCase):
|
||||
body=json.dumps(low),
|
||||
headers={'Content-Type': self.content_type_map['json'],
|
||||
saltnado.AUTH_TOKEN_HEADER: self.token['token']},
|
||||
connect_timeout=10,
|
||||
request_timeout=10,
|
||||
)
|
||||
response_obj = json.loads(response.body)
|
||||
self.assertEqual(len(response_obj['return']), 3) # make sure we got 3 responses
|
||||
@ -255,6 +276,8 @@ class TestSaltAPIHandler(SaltnadoTestCase):
|
||||
body=json.dumps(low),
|
||||
headers={'Content-Type': self.content_type_map['json'],
|
||||
saltnado.AUTH_TOKEN_HEADER: self.token['token']},
|
||||
connect_timeout=10,
|
||||
request_timeout=10,
|
||||
)
|
||||
response_obj = json.loads(response.body)
|
||||
self.assertEqual(response_obj['return'], [['minion', 'sub_minion']])
|
||||
@ -279,6 +302,8 @@ class TestMinionSaltAPIHandler(SaltnadoTestCase):
|
||||
method='GET',
|
||||
headers={saltnado.AUTH_TOKEN_HEADER: self.token['token']},
|
||||
follow_redirects=False,
|
||||
connect_timeout=10,
|
||||
request_timeout=10,
|
||||
)
|
||||
response_obj = json.loads(response.body)
|
||||
self.assertEqual(len(response_obj['return']), 1)
|
||||
@ -293,6 +318,8 @@ class TestMinionSaltAPIHandler(SaltnadoTestCase):
|
||||
method='GET',
|
||||
headers={saltnado.AUTH_TOKEN_HEADER: self.token['token']},
|
||||
follow_redirects=False,
|
||||
connect_timeout=10,
|
||||
request_timeout=10,
|
||||
)
|
||||
response_obj = json.loads(response.body)
|
||||
self.assertEqual(len(response_obj['return']), 1)
|
||||
@ -309,6 +336,8 @@ class TestMinionSaltAPIHandler(SaltnadoTestCase):
|
||||
body=json.dumps(low),
|
||||
headers={'Content-Type': self.content_type_map['json'],
|
||||
saltnado.AUTH_TOKEN_HEADER: self.token['token']},
|
||||
connect_timeout=10,
|
||||
request_timeout=10,
|
||||
)
|
||||
response_obj = json.loads(response.body)
|
||||
# TODO: verify pub function? Maybe look at how we test the publisher
|
||||
@ -327,6 +356,8 @@ class TestMinionSaltAPIHandler(SaltnadoTestCase):
|
||||
body=json.dumps(low),
|
||||
headers={'Content-Type': self.content_type_map['json'],
|
||||
saltnado.AUTH_TOKEN_HEADER: self.token['token']},
|
||||
connect_timeout=10,
|
||||
request_timeout=10,
|
||||
)
|
||||
response_obj = json.loads(response.body)
|
||||
# TODO: verify pub function? Maybe look at how we test the publisher
|
||||
@ -349,6 +380,8 @@ class TestMinionSaltAPIHandler(SaltnadoTestCase):
|
||||
body=json.dumps(low),
|
||||
headers={'Content-Type': self.content_type_map['json'],
|
||||
saltnado.AUTH_TOKEN_HEADER: self.token['token']},
|
||||
connect_timeout=10,
|
||||
request_timeout=10,
|
||||
)
|
||||
self.assertEqual(response.code, 400)
|
||||
|
||||
@ -431,6 +464,8 @@ class TestRunSaltAPIHandler(SaltnadoTestCase):
|
||||
body=json.dumps(low),
|
||||
headers={'Content-Type': self.content_type_map['json'],
|
||||
saltnado.AUTH_TOKEN_HEADER: self.token['token']},
|
||||
connect_timeout=10,
|
||||
request_timeout=10,
|
||||
)
|
||||
response_obj = json.loads(response.body)
|
||||
self.assertEqual(response_obj['return'], [{'minion': True, 'sub_minion': True}])
|
||||
@ -456,7 +491,9 @@ class TestEventsSaltAPIHandler(SaltnadoTestCase):
|
||||
self.events_to_fire = 5
|
||||
response = self.fetch('/events',
|
||||
headers={saltnado.AUTH_TOKEN_HEADER: self.token['token']},
|
||||
streaming_callback=self.on_event
|
||||
streaming_callback=self.on_event,
|
||||
connect_timeout=10,
|
||||
request_timeout=10,
|
||||
)
|
||||
|
||||
def _stop(self):
|
||||
@ -516,6 +553,8 @@ class TestWebhookSaltAPIHandler(SaltnadoTestCase):
|
||||
method='POST',
|
||||
body='foo=bar',
|
||||
headers={saltnado.AUTH_TOKEN_HEADER: self.token['token']},
|
||||
connect_timeout=10,
|
||||
request_timeout=10,
|
||||
)
|
||||
response_obj = json.loads(response.body)
|
||||
self.assertTrue(response_obj['success'])
|
||||
|
Loading…
Reference in New Issue
Block a user