last wip comment :-)
parent
68ffbf23e2
commit
2acda459b2
@ -1,41 +0,0 @@
|
|||||||
from src.main.python.ddadevops.domain import Validateable
|
|
||||||
|
|
||||||
|
|
||||||
class TestValidateable(Validateable):
|
|
||||||
def __init__(self, value):
|
|
||||||
self.field = value
|
|
||||||
|
|
||||||
def validate(self):
|
|
||||||
return self.__validate_is_not_empty__('field')
|
|
||||||
|
|
||||||
|
|
||||||
def test_should_validate_non_empty_strings():
|
|
||||||
|
|
||||||
sut = TestValidateable("content")
|
|
||||||
assert sut.is_valid()
|
|
||||||
|
|
||||||
sut = TestValidateable(None)
|
|
||||||
assert not sut.is_valid()
|
|
||||||
|
|
||||||
sut = TestValidateable('')
|
|
||||||
assert not sut.is_valid()
|
|
||||||
|
|
||||||
|
|
||||||
def test_should_validate_non_empty_others():
|
|
||||||
|
|
||||||
sut = TestValidateable(1)
|
|
||||||
assert sut.is_valid()
|
|
||||||
|
|
||||||
sut = TestValidateable(1.0)
|
|
||||||
assert sut.is_valid()
|
|
||||||
|
|
||||||
sut = TestValidateable(True)
|
|
||||||
assert sut.is_valid()
|
|
||||||
|
|
||||||
sut = TestValidateable(None)
|
|
||||||
assert not sut.is_valid()
|
|
||||||
|
|
||||||
def test_validate_with_reason():
|
|
||||||
|
|
||||||
sut = TestValidateable(None)
|
|
||||||
assert sut.validate()[0] == "Field 'field' may not be empty."
|
|
Loading…
Reference in New Issue