def test_valid_data(self): data = {'nomor':'12345', 'tipe':'p'} form = PhoneForm(data, profil=self.profil) self.assertTrue(form.is_valid()) phone = form.save() self.assertEqual(phone.nomor, '12345') self.assertEqual(phone.tipe, 'p') self.assertEqual(phone.profil, self.profil)
def test_invalid_data(self): data = {} form = PhoneForm(data, profil=self.profil) self.assertFalse(form.is_valid())