def default_command(self): default_command = Command(name="name", description="description") default_command.save = Mock() default_command.validate = Mock() default_command.delete = Mock() return default_command
def system_not_permitted(garden): system = System( name="system_not_permitted", version="0.0.1", namespace=garden.name, commands=[Command(name="command_not_permitted")], ).save() yield system system.delete()
def system_permitted(garden): system = System( name="permitted_system", version="0.0.1", namespace=garden.name, commands=[Command(name="icandoit")], ).save() yield system system.delete()
def setUp(self): self.app = brew_view.app.test_client() self.default_instance = Instance(name="default", status="RUNNING") self.default_command = Command(id="54ac18f778c4b57e963f3c18", name="command", description="foo") self.default_system = System( id="54ac18f778c4b57e963f3c18", name="default_system", version="1.0.0", instances=[self.default_instance], commands=[self.default_command], max_instances="1", )
def setUp(self): self.app = brew_view.app.test_client() self.default_instance = Instance(name="default", status="RUNNING") self.default_command = Command(id="54ac18f778c4b57e963f3c18", name="command", description="foo") self.default_system = System( id="54ac18f778c4b57e963f3c18", name="default_system", version="1.0.0", instances=[self.default_instance], commands=[self.default_command], max_instances="1", ) self.client_mock = Mock(name="client_mock") self.fake_context = MagicMock( __enter__=Mock(return_value=self.client_mock), __exit__=Mock(return_value=False), )
def test_clean_fail_duplicate_parameter_keys(self): parameter = Parameter(key="foo", optional=False) command = Command(name="foo", parameters=[parameter, parameter]) with pytest.raises(ModelValidationError): command.clean()
def test_clean_empty_name(self, params): with pytest.raises(ModelValidationError): Command(**params).clean()
def test_clean(self): Command(name="foo", parameters=[Parameter(key="foo", optional=False)]).clean()
def test_repr(self): c = Command(name="foo", description="bar", parameters=[]) assert repr(c) == "<Command: foo>"
def test_str(self): assert str(Command(name="foo", parameters=[])) == "foo"