def test_given_a_document_when_validated_with_an_action_then_field_validated_with_action(self): field1 = Mock(Field) field1.name = "field1" content = {"field1": "value1"} document = Document([field1]) document.validate(content, "action") field1.validate.assert_called_with("value1", "action")
def test_given_a_document_when_validated_with_an_action_then_field_validated_with_action( self): field1 = Mock(Field) field1.name = 'field1' content = {'field1': 'value1'} document = Document([field1]) document.validate(content, 'action') field1.validate.assert_called_with('value1', 'action')
def test_given_a_list_of_fields_when_document_validated_then_each_field_validated(self): field1 = Mock(Field) field1.name = "field1" field2 = Mock(Field) field2.name = "field2" content = {"field1": "value1", "field2": "value2"} document = Document([field1, field2]) document.validate(content) field1.validate.assert_called_with("value1", None) field2.validate.assert_called_with("value2", None)
def test_given_a_list_of_fields_when_document_validated_then_each_field_validated( self): field1 = Mock(Field) field1.name = 'field1' field2 = Mock(Field) field2.name = 'field2' content = {'field1': 'value1', 'field2': 'value2'} document = Document([field1, field2]) document.validate(content) field1.validate.assert_called_with('value1', None) field2.validate.assert_called_with('value2', None)