コード例 #1
0
 def test_check_http_unsupported_method(self):
     ServiceCheck.consul_version = (0, 8, 4)
     params = self.params_http
     del params['body']
     check = ServiceCheck.http(self.dummyservice, params)
     # method isn't supported, check should be None
     self.assertIsNone(check)
コード例 #2
0
 def test_check_http(self):
     params = self.params_http
     check = ServiceCheck.http(self.dummyservice, params)
     self.assertEqual(check['http'], 'http://6.6.6.6:666/path')
     self.assertEqual(check['interval'], '17s')
     self.assertEqual(check['timeout'], '3s')
     self.assertEqual(check['header'], {'x-foo': ['bar', 'baz']})
     self.assertEqual(check['Method'], 'HEAD')
     self.assertEqual(check['Body'], params['body'])
     self.assertEqual(check['DeregisterCriticalServiceAfter'], '666s')
     self.assertEqual(check['Status'], 'passing')
     self.assertEqual(len(check), 8)
コード例 #3
0
 def test_check_http_invalid_header(self):
     params = self.params_http
     params['header'] = 'invalid_json'
     check = ServiceCheck.http(self.dummyservice, params)
     self.assertNotIn('header', check)
コード例 #4
0
 def test_check_http_unsupported_body(self):
     ServiceCheck.consul_version = (1, 0, 0)
     params = self.params_http
     check = ServiceCheck.http(self.dummyservice, params)
     # body isn't supported, check should be None
     self.assertIsNone(check)
コード例 #5
0
 def test_check_http_no_body(self):
     params = self.params_http
     del params['body']
     check = ServiceCheck.http(self.dummyservice, params)
     self.assertNotIn('Body', check)
コード例 #6
0
 def test_check_http_no_method(self):
     params = self.params_http
     del params['http_method']
     check = ServiceCheck.http(self.dummyservice, params)
     self.assertNotIn('Method', check)
コード例 #7
0
 def test_check_http_no_path(self):
     params = self.params_http
     params['http'] = ''
     check = ServiceCheck.http(self.dummyservice, params)
     self.assertIsNone(check)