コード例 #1
0
    def test_check(self):
        result = _parser._parse_check('spam:handler')

        self.assertEqual('spam_check', result)
        _checks.registered_checks['spam'].assert_called_once_with('spam',
                                                                  'handler')
        self.assertFalse(_checks.registered_checks[None].called)
コード例 #2
0
ファイル: test_parser.py プロジェクト: fp314/for_openstack
    def test_no_handler(self):
        result = _parser._parse_check('no:handler')

        self.assertIsInstance(result, _checks.FalseCheck)
コード例 #3
0
ファイル: test_parser.py プロジェクト: fp314/for_openstack
    def test_bad_rule(self):
        result = _parser._parse_check('foobar')

        self.assertIsInstance(result, _checks.FalseCheck)
コード例 #4
0
ファイル: test_parser.py プロジェクト: fp314/for_openstack
    def test_true(self):
        result = _parser._parse_check('@')

        self.assertIsInstance(result, _checks.TrueCheck)
コード例 #5
0
ファイル: test_parser.py プロジェクト: fp314/for_openstack
    def test_false(self):
        result = _parser._parse_check('!')

        self.assertIsInstance(result, _checks.FalseCheck)
コード例 #6
0
    def test_check_default(self):
        result = _parser._parse_check('spam:handler')

        self.assertEqual('none_check', result)
        _checks.registered_checks[None].assert_called_once_with('spam',
                                                                'handler')
コード例 #7
0
    def test_no_handler(self):
        result = _parser._parse_check('no:handler')

        self.assertTrue(isinstance(result, _checks.FalseCheck))
コード例 #8
0
    def test_bad_rule(self):
        result = _parser._parse_check('foobar')

        self.assertTrue(isinstance(result, _checks.FalseCheck))
コード例 #9
0
    def test_true(self):
        result = _parser._parse_check('@')

        self.assertTrue(isinstance(result, _checks.TrueCheck))
コード例 #10
0
    def test_false(self):
        result = _parser._parse_check('!')

        self.assertTrue(isinstance(result, _checks.FalseCheck))
コード例 #11
0
ファイル: test_parser.py プロジェクト: frac/oslo.policy
    def test_no_handler(self, mock_log):
        result = _parser._parse_check('no:handler')

        self.assertIsInstance(result, _checks.FalseCheck)
        mock_log.error.assert_called()
コード例 #12
0
ファイル: test_parser.py プロジェクト: frac/oslo.policy
    def test_bad_rule(self, mock_log):
        result = _parser._parse_check('foobar')

        self.assertIsInstance(result, _checks.FalseCheck)
        mock_log.exception.assert_called_once()