~ubuntuone-hackers/conn-check/trunk

« back to all changes in this revision

Viewing changes to tests.py

  • Committer: Ubuntu One Auto Copilot
  • Author(s): Guillermo Gonzalez
  • Date: 2023-07-04 14:17:08 UTC
  • mfrom: (143.1.2 conn-check-focal)
  • Revision ID: otto-copilot@canonical.com-20230704141708-s8dfji74114kniy1
fix 2 calls to yaml.load, use yaml.safe_load instead

Merged from https://code.launchpad.net/~verterok/conn-check/focal/+merge/445911

Show diffs side-by-side

added added

removed removed

Lines of Context:
278
278
        self.assertThat(wrapped.subchecks[1], FunctionCheckMatcher('connect', None))
279
279
 
280
280
    def test_make_mongodb_check(self):
 
281
        if sys.version_info[0] < 3:
 
282
            raise self.skipException('txmongo uses collections.abc')
281
283
        result = make_mongodb_check('localhost', 8080)
282
284
        self.assertIsInstance(result, PrefixCheckWrapper)
283
285
        self.assertEqual(result.prefix, 'mongodb:localhost:8080:')
290
292
        self.assertThat(wrapped.subchecks[1], FunctionCheckMatcher('connect', None))
291
293
 
292
294
    def test_make_mongodb_check_with_username(self):
 
295
        if sys.version_info[0] < 3:
 
296
            raise self.skipException('txmongo uses collections.abc')
293
297
        result = make_mongodb_check('localhost', 8080, 'foo')
294
298
        self.assertIsInstance(result, PrefixCheckWrapper)
295
299
        self.assertEqual(result.prefix, 'mongodb:localhost:8080:')