Example #1
0
    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())
Example #2
0
    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())
Example #3
0
    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)
Example #4
0
    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)
Example #5
0
 def test_invalid_form(self):
     form = HookForm(data={})
     self.assertFalse(form.is_valid())