Example #1
0
    def test_series_is_created_for_new_event(self):
        form = CreateEventForm(data=self.postData)
        self.assertEquals(form.is_valid(), True)

        form.save()

        series = Series.objects.all()
        self.assertEquals(len(series), 1)
        self.assertEquals(series[0].name, "Correct Event")
Example #2
0
    def test_foreign_key_for_event_is_set(self):
        form = CreateEventForm(data=self.postData)
        self.assertEquals(form.is_valid(), True)

        form.save()

        series = Series.objects.all()[0]
        event = Event.objects.all()[0]

        self.assertEquals(event.series, series)
Example #3
0
    def test_event_is_created(self):
        form = CreateEventForm(data=self.postData)
        self.assertEquals(form.is_valid(), True)

        form.save()

        events = Event.objects.all()
        event = events[0]

        self.assertEquals(len(events), 1)
        self.assertEquals(event.name, "Correct Event")
Example #4
0
def create_event(request, room_id):
	room = get_object_or_404(Room, pk=room_id)

	if request.method == "POST":
		form = CreateEventForm(request.POST)
		if form.is_valid():
			form.save()
			return HttpResponseRedirect(reverse('booking:detail', args=[room.id]))
	else:
		form = CreateEventForm()

	return render(request, 'booking/create_event.html', {
		'form': form,
		'room': room
	})
Example #5
0
    def test_series_data_matches_event_data(self):
        form = CreateEventForm(data=self.postData)
        self.assertEquals(form.is_valid(), True)

        form.save()

        series = Series.objects.all()[0]
        event = Event.objects.all()[0]

        self.assertEquals(series.setupStartTime, event.setupStartTime)
        self.assertEquals(series.eventStartTime, event.eventStartTime)
        self.assertEquals(series.eventEndTime, event.eventEndTime)
        self.assertEquals(series.teardownEndTime, event.teardownEndTime)
        self.assertEquals(series.name, event.name)
        self.assertEquals(series.notes, event.notes)
        self.assertEquals(series.rooms.all()[0], event.rooms.all()[0])
        self.assertEquals(series.attributes.all()[0], event.attributes.all()[0])
        self.assertEquals(series.attributes.all()[1], event.attributes.all()[1])