def test_validate_handles_invalid_config_exception(self): """ Assert that validate() properly handles the InvalidConfig Exception. """ # The CA certificate must be a string, and max_speed must be a number. Both of these errors # should make it out the door config = PluginCallConfiguration({}, {'max_speed': 'fast', 'ssl_ca_cert': 5}) result, msg = configuration.validate(config) self.assertFalse(result, False) # For ss_ca_cert being 5 self.assertTrue('should be a string' in msg) # For max_speed being 'fast' self.assertTrue('positive numerical value' in msg)
def test_validate_handles_invalid_config_exception(self): """ Assert that validate() properly handles the InvalidConfig Exception. """ # The CA certificate must be a string, and max_speed must be a number. Both of these errors # should make it out the door config = PluginCallConfiguration({}, { 'max_speed': 'fast', 'ssl_ca_cert': 5 }) result, msg = configuration.validate(config) self.assertFalse(result, False) # For ss_ca_cert being 5 self.assertTrue('should be a string' in msg) # For max_speed being 'fast' self.assertTrue('positive numerical value' in msg)
def test_validate(self, missing, queries, feed): """ Tests that the validate() call aggregates to all of the specific test calls. """ # Setup all_mock_calls = (feed, missing, queries) for x in all_mock_calls: x.return_value = True, None # Test c = PluginCallConfiguration({}, {}) result, msg = configuration.validate(c) # Verify self.assertTrue(result) self.assertTrue(msg is None) for x in all_mock_calls: x.assert_called_once_with(c)
def test_validate_with_failure(self, missing, queries, feed): """ Tests that the validate() call aggregates to all of the specific test calls. """ # Setup all_mock_calls = (feed, missing, queries) for x in all_mock_calls: x.return_value = True, None all_mock_calls[1].return_value = False, "foo" # Test c = {} result, msg = configuration.validate(c) # Verify self.assertTrue(not result) self.assertEqual(msg, "foo") all_mock_calls[0].assert_called_once_with(c) all_mock_calls[1].assert_called_once_with(c) self.assertEqual(0, all_mock_calls[2].call_count)
def test_validate_with_failure(self, missing, queries, feed): """ Tests that the validate() call aggregates to all of the specific test calls. """ # Setup all_mock_calls = (feed, missing, queries) for x in all_mock_calls: x.return_value = True, None all_mock_calls[1].return_value = False, 'foo' # Test c = {} result, msg = configuration.validate(c) # Verify self.assertTrue(not result) self.assertEqual(msg, 'foo') all_mock_calls[0].assert_called_once_with(c) all_mock_calls[1].assert_called_once_with(c) self.assertEqual(0, all_mock_calls[2].call_count)
def validate_config(self, repo, config): return configuration.validate(config)
def validate_config(self, repo, config, related_repos): return configuration.validate(config)