211
212
FunctionCheckMatcher('tcp:localhost:8080', 'localhost:8080'))
212
213
self.assertThat(wrapped.subchecks[1], FunctionCheckMatcher('connect', None))
215
def test_make_mongodb_check(self):
216
result = make_mongodb_check('localhost', 8080)
217
self.assertIsInstance(result, PrefixCheckWrapper)
218
self.assertEqual(result.prefix, 'mongodb:localhost:8080:')
219
wrapped = result.wrapped
220
self.assertIsInstance(wrapped, MultiCheck)
221
self.assertIs(wrapped.strategy, sequential_strategy)
222
self.assertEqual(len(wrapped.subchecks), 2)
223
self.assertThat(wrapped.subchecks[0],
224
FunctionCheckMatcher('tcp:localhost:8080', 'localhost:8080'))
225
self.assertThat(wrapped.subchecks[1], FunctionCheckMatcher('connect', None))
227
def test_make_mongodb_check_with_username(self):
228
result = make_mongodb_check('localhost', 8080, 'foo')
229
self.assertIsInstance(result, PrefixCheckWrapper)
230
self.assertEqual(result.prefix, 'mongodb:localhost:8080:')
231
wrapped = result.wrapped
232
self.assertIsInstance(wrapped, MultiCheck)
233
self.assertIs(wrapped.strategy, sequential_strategy)
234
self.assertEqual(len(wrapped.subchecks), 2)
235
self.assertThat(wrapped.subchecks[0],
236
FunctionCheckMatcher('tcp:localhost:8080', 'localhost:8080'))
237
self.assertThat(wrapped.subchecks[1],
238
FunctionCheckMatcher('connect with auth', None))
214
240
def test_check_from_description_unknown_type(self):
215
241
e = self.assertRaises(AssertionError,
216
242
check_from_description, {'type': 'foo'})