コード例 #1
0
    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)
コード例 #2
0
    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)
コード例 #3
0
    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)
コード例 #4
0
    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)
コード例 #5
0
    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)
コード例 #6
0
    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)
コード例 #7
0
ファイル: importer.py プロジェクト: snmpboy/pulp_puppet
 def validate_config(self, repo, config):
     return configuration.validate(config)
コード例 #8
0
ファイル: importer.py プロジェクト: kimjohansen/pulp_puppet
 def validate_config(self, repo, config):
     return configuration.validate(config)
コード例 #9
0
ファイル: importer.py プロジェクト: abhaychrungoo/pulp_puppet
 def validate_config(self, repo, config, related_repos):
     return configuration.validate(config)
コード例 #10
0
ファイル: importer.py プロジェクト: jdef/pulp_puppet
 def validate_config(self, repo, config, related_repos):
     return configuration.validate(config)