def test_search_show_past_events(db, client):
    future_event = ApprovedEventFactory.create()
    past_event = PastEventFactory.create(status='APPROVED')

    response = client.get('/search/?past=yes')

    assert future_event.get_absolute_url() in response.content
    assert past_event.get_absolute_url() in response.content

    map(lambda x: x.delete(), [future_event, past_event])
def test_search_show_past_events(db, client):
    future_event = ApprovedEventFactory.create()
    past_event = PastEventFactory.create(status='APPROVED')

    response = client.get('/search/?past=yes')

    assert future_event.get_absolute_url() in response.content
    assert past_event.get_absolute_url() in response.content

    map(lambda x: x.delete(), [future_event, past_event])
示例#3
0
	def test_get_filtered_events_with_search_filter_searching_description_and_past_events(self):
		event = PastEventFactory.create(description='Learn basics about programming in python', status='APPROVED')

		theme = EventTheme.objects.filter(pk=1)
		audience = EventAudience.objects.filter(pk=1)
		event.theme.add(*theme)
		event.audience.add(*audience)
		event.save()

		search_filter = "python"
		events = get_filtered_events(search_filter=search_filter, past_events=True)
		self.assertEquals(1, events.count())
		self.assertEquals(2, events[0].pk)
示例#4
0
	def test_get_filtered_events_with_search_filter_and_more_past_approved_events(self):
		event = PastEventFactory.create(title='Programming for dummies asdasd', status='APPROVED')

		theme = EventTheme.objects.filter(pk=1)
		audience = EventAudience.objects.filter(pk=1)
		event.theme.add(*theme)
		event.audience.add(*audience)
		event.save()

		test_event = Event.objects.get(title='asdasd')
		test_event.status = 'APPROVED'
		test_event.save()
		search_filter = "asdasd"
		events = get_filtered_events(search_filter=search_filter, past_events=True)
		self.assertEquals(2, events.count())
示例#5
0
    def test_get_filtered_events_with_search_filter_searching_description_and_past_events(
            self):
        event = PastEventFactory.create(
            description='Learn basics about programming in python',
            status='APPROVED')

        theme = EventTheme.objects.filter(pk=1)
        audience = EventAudience.objects.filter(pk=1)
        event.theme.add(*theme)
        event.audience.add(*audience)
        event.save()

        search_filter = "python"
        events = get_filtered_events(search_filter=search_filter,
                                     past_events=True)
        self.assertEquals(1, events.count())
        self.assertEquals(2, events[0].pk)
示例#6
0
    def test_get_filtered_events_with_search_filter_and_more_past_approved_events(
            self):
        event = PastEventFactory.create(title='Programming for dummies asdasd',
                                        status='APPROVED')

        theme = EventTheme.objects.filter(pk=1)
        audience = EventAudience.objects.filter(pk=1)
        event.theme.add(*theme)
        event.audience.add(*audience)
        event.save()

        test_event = Event.objects.get(title='asdasd')
        test_event.status = 'APPROVED'
        test_event.save()
        search_filter = "asdasd"
        events = get_filtered_events(search_filter=search_filter,
                                     past_events=True)
        self.assertEquals(2, events.count())