Example #1
0
 def test_complete_actions_config(self):
     """Charm has multiple actions."""
     linter = Mock()
     actions = {"do": {"description": "a thing"}, "do-not": {"description": "not a thing"}}
     with patch("os.path.exists"):
         validate_actions(actions, "actions", linter)
     self.assertFalse(linter.err.called)
Example #2
0
 def test_minimal_actions_config(self):
     """Charm has the minimum allowed actions configuration."""
     linter = Mock()
     actions = {
         'an-action': {}
     }
     validate_actions(actions, 'actions', linter)
     self.assertFalse(linter.err.called)
Example #3
0
    def test_juju_actions_fail(self):
        """Charm has multiple actions."""
        linter = Mock()
        actions = {"juju-do": {"description": "a thing"}, "do-not": {"description": "not a thing"}}

        with patch("os.path.exists"):
            validate_actions(actions, "actions", linter)
        self.assertEqual(linter.err.call_count, 1)
Example #4
0
 def test_complete_actions_config(self):
     """Charm has multiple actions."""
     linter = Mock()
     actions = {
         'do': {
             'description': 'a thing',
         },
         'do-not': {
             'description': 'not a thing',
         },
     }
     with patch('os.path.exists'):
         validate_actions(actions, 'actions', linter)
     self.assertFalse(linter.err.called)
Example #5
0
    def test_juju_actions_fail(self):
        """Charm has multiple actions."""
        linter = Mock()
        actions = {
            'juju-do': {
                'description': 'a thing',
            },
            'do-not': {
                'description': 'not a thing',
            },
        }

        with patch('os.path.exists'):
            validate_actions(actions, 'actions', linter)
        self.assertEqual(linter.err.call_count, 1)