def test_StrictFilePathField_mommy(): mommy = Mommy(model=FilePathFieldModel) mommy.type_mapping.update(MODEL_MOMMY_MAPPING) with pytest.raises(TypeError): mommy.prepare() with pytest.raises(TypeError): mommy.make()
def test_StrictIntegerField_mommy(): mommy = Mommy(model=IntegerFieldModel) mommy.type_mapping.update(MODEL_MOMMY_MAPPING) try: mommy.prepare() except ValidationError: # this is OK because it means our mapping works pass try: mommy.make() except ValidationError: # this is OK because it means our mapping works pass
def test_StrictTextField_mommy(): mommy = Mommy(model=TextFieldModel) mommy.type_mapping.update(MODEL_MOMMY_MAPPING) try: mommy.prepare() except ValidationError: # the mapping + validator worked but mommy shoved in too much data. pass try: mommy.make() except ValidationError: # the mapping + validator worked but mommy shoved in too much data. pass
def test_StrictGenericIPAddressField_mommy(): mommy = Mommy(model=GenericIPAddressFieldModel) mommy.type_mapping.update(MODEL_MOMMY_MAPPING) mommy.prepare() mommy.make()
def test_StrictURLField_mommy(): mommy = Mommy(model=URLFieldModel) mommy.type_mapping.update(MODEL_MOMMY_MAPPING) mommy.prepare() mommy.make()
def test_StrictCsvField_mommy(): mommy = Mommy(model=CommaSeparatedIntegerFieldModel) mommy.type_mapping.update(MODEL_MOMMY_MAPPING) mommy.prepare() mommy.make()
def test_StrictPositiveIntegerField_mommy(): mommy = Mommy(model=PositiveIntegerFieldModel) mommy.type_mapping.update(MODEL_MOMMY_MAPPING) mommy.prepare() mommy.make()