Пример #1
0
 def test_no_launchpad_name(self):
     warnings = []
     errors = []
     validate.validate_launchpad(
         {},
         warnings.append,
         errors.append,
     )
     self.assertEqual(0, len(warnings))
     self.assertEqual(1, len(errors))
Пример #2
0
 def test_valid_launchpad_name(self, get):
     get.return_value = mock.Mock(status_code=200)
     warnings = []
     errors = []
     validate.validate_launchpad(
         {'launchpad': 'oslo.config'},
         warnings.append,
         errors.append,
     )
     self.assertEqual(0, len(warnings))
     self.assertEqual(0, len(errors))
Пример #3
0
 def test_invalid_launchpad_name(self, get):
     get.return_value = mock.Mock(status_code=404)
     warnings = []
     errors = []
     validate.validate_launchpad(
         {'launchpad': 'nonsense-name'},
         warnings.append,
         errors.append,
     )
     self.assertEqual(0, len(warnings))
     self.assertEqual(1, len(errors))
Пример #4
0
 def test_launchpad_timeout(self, get):
     import requests
     get.side_effect = requests.exceptions.ConnectionError('testing')
     warnings = []
     errors = []
     validate.validate_launchpad(
         {'launchpad': 'oslo.config'},
         warnings.append,
         errors.append,
     )
     self.assertEqual(1, len(warnings))
     self.assertEqual(0, len(errors))