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)
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)
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)
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)
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)