def test_can_create_hook_with_hook_event(self):
    hookevent = HookEventFactory()
    hook = HookFactory()
    product_class = ProductClass.objects.create(name='Book')
    page = self.get(reverse('hook-create', kwargs={'hook_class_slug': product_class.slug}))
    form = page.form
    form['name'] = u'books'
    form['description'] = u'this is description'
    form['hookevent_set-0-id'] = hook
    form['hookevent_set-0-signal_type'] = hookevent.signal_type
    form['hookevent_set-0-URL'] = hookevent.URL
    form['hookevent_set-0-extra_headers'] = hookevent.extra_headers
    response = form.submit(name='action', value='save')
    assert (Hook.objects.count() == 2)
def test_can_create_hook_with_hook_event(self):
    hookevent = HookEventFactory()
    hook = HookFactory()
    product_class = ProductClass.objects.create(name='Book')
    page = self.get(reverse('hook-create', kwargs={'hook_class_slug': product_class.slug}))
    form = page.form
    form['name'] = u'books'
    form['description'] = u'this is description'
    form['hookevent_set-0-id'] = hook
    form['hookevent_set-0-signal_type'] = hookevent.signal_type
    form['hookevent_set-0-URL'] = hookevent.URL
    form['hookevent_set-0-extra_headers'] = hookevent.extra_headers
    response = form.submit(name='action', value='save')
    assert (Hook.objects.count() == 2)