def test_personform_get_or_create(d): form = PersonForm(d) form.full_clean() result0 = form.get_or_create() Fixture('./src/person/tests/test_personform.json', models=[Person]).assertNoDiff() # Second call should not create a new instance result1 = form.get_or_create() assert result0 == result1 Fixture('person/tests/test_personform.json', models=[Person]).assertNoDiff()
def test_personform_twins_get_or_create(d, s): # We first make a call for jamesy form = PersonForm(d) form.full_clean() result0 = form.get_or_create() # Second call should create a new instance, # since seb is another person form = PersonForm(s) form.full_clean() result1 = form.get_or_create() assert result0 != result1 Fixture('person/tests/test_personform_twins.json', models=[Person]).assertNoDiff()