Ejemplo n.º 1
0
 def invalid_payload_fails(self):
     user = get_user("ignite-user")
     request = utils.get_request("post", "/event/add/", data={}, user=user)
     response = views.event_add(request)
     eq_(response.status_code, 200)
     ok_(response.context_data["form"].errors)
     self._tear_down()
Ejemplo n.º 2
0
 def test_valid_payload_succeeds(self):
     user = get_user("ignite-user")
     data = {
         "name": "Gigabit community",
         "status": Event.DRAFT,
         "start_datetime": "2013-12-14 14:30:59",
         "address": "London UK",
         "scope": 1,
         "description": "Gigabit event",
     }
     formset_data = utils.get_inline_payload(EventURLFormSet)
     data.update(formset_data)
     request = utils.get_request("post", "/event/add/", data=data, user=user)
     request._messages = utils.TestMessagesBackend(request)
     response = views.event_add(request)
     eq_(response.status_code, 302)
     event = Event.objects.get(name="Gigabit community")
     eq_(response["Location"], event.get_absolute_url())
     self._tear_down()
Ejemplo n.º 3
0
 def test_event_add_detail(self):
     request = utils.get_request("get", "/event/add/", user=utils.get_user_mock())
     response = views.event_add(request)
     eq_(response.status_code, 200)
     eq_(response.template_name, "events/object_add.html")
     eq_(sorted(response.context_data.keys()), ["form", "formset"])
Ejemplo n.º 4
0
 def test_add_event_requires_auth(self):
     request = utils.get_request("get", "/event/add/", user=utils.get_anon_mock())
     response = views.event_add(request)
     eq_(response.status_code, 302)
     eq_(response["Location"], utils.get_login_url("/event/add/"))