def test_valid_form(self): form_data = { 'target': "http://example.com", 'event': HookForm.ADMIN_EVENTS[0][0] } form = HookForm(data=form_data) self.assertTrue(form.is_valid())
def test_valid_form(self): form_data = { 'user': self.user.id, 'target': "http://example.com", 'event': HookForm.get_admin_events()[0][0] } form = HookForm(data=form_data) self.assertTrue(form.is_valid())
def test_form_save(self): form_data = { 'target': "http://example.com", 'event': HookForm.ADMIN_EVENTS[0][0] } form = HookForm(data=form_data) self.assertTrue(form.is_valid()) instance = form.save() self.assertIsInstance(instance, Hook)
def test_form_save(self): form_data = { 'user': self.user.id, 'target': "http://example.com", 'event': HookForm.get_admin_events()[0][0] } form = HookForm(data=form_data) self.assertTrue(form.is_valid()) instance = form.save() self.assertIsInstance(instance, Hook)
def test_invalid_form(self): form = HookForm(data={}) self.assertFalse(form.is_valid())