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_fail_duplicate_parameter_keys(self): nested = Parameter(key="foo") with pytest.raises(ModelValidationError): Parameter(key="foo", optional=False, parameters=[nested, nested]).clean()
def test_clean(self): Command(name="foo", parameters=[Parameter(key="foo", optional=False)]).clean()
def test_clean_fail_nullable_optional_but_no_default(self): with pytest.raises(ModelValidationError): Parameter(key="foo", optional=True, default=None, nullable=False).clean()
def test_clean(self): Parameter(key="foo", optional=False).clean()
def test_default_display_name(self): p = Parameter(key="foo") assert p.display_name == "foo"
def test_repr(self): p = Parameter(key="foo", description="bar", type="Boolean", optional=False) assert repr(p) == "<Parameter: key=foo, type=Boolean, description=bar>"
def test_str(self): p = Parameter(key="foo", description="bar", type="Boolean", optional=False) assert str(p) == "foo"