コード例 #1
0
	def test_get_filtered_events_with_search_filter_searching_description_when_no_approved_event(self):
		event = EventFactory(description='Learn basics about programming in python')
		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)
		self.assertEquals(0, events.count())

		event.delete()
コード例 #2
0
def test_edit_event_without_end_date(db, admin_user, admin_client):
    event = EventFactory.create(creator=admin_user)

    event_data = {
        'audience': [6, 7],
        'theme': [3, 4],
        'contact_person': u'*****@*****.**',
        'country': u'SI',
        'description': u'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod\r\ntempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,\r\nquis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo\r\nconsequat. Duis aute irure dolor in reprehenderit in voluptate velit esse\r\ncillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non\r\nproident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
        'event_url': u'',
        'location': u'Ljubljana, Slovenia',
        'organizer': u'Mozilla Slovenija',
        'picture': '',
        'start_date': datetime.datetime.now(),
        'end_date': '',
        'tags': [u'css', u'html', u'web'],
        'title': u'Webmaker Ljubljana',
        'user_email': u'*****@*****.**'
    }

    response_edited = admin_client.post(
        reverse(
            'web.edit_event',
            args=[
                event.id]),
        event_data)

    assert response_edited.status_code == 200
    assert 'end_date' in response_edited.context['form'].errors

    event.delete()
コード例 #3
0
def test_edit_event_without_end_date(db, admin_user, admin_client):
	event = EventFactory.create(creator=admin_user)

	event_data = {
		'audience': [6, 7],
		'theme': [3,4],
		'contact_person': u'*****@*****.**',
		'country': u'SI',
		'description': u'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod\r\ntempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,\r\nquis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo\r\nconsequat. Duis aute irure dolor in reprehenderit in voluptate velit esse\r\ncillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non\r\nproident, sunt in culpa qui officia deserunt mollit anim id est laborum.',
		'event_url': u'',
		'location': u'Ljubljana, Slovenia',
		'organizer': u'Mozilla Slovenija',
		'picture': '',
		'start_date': datetime.datetime.now(),
		'end_date': '',
		'tags': [u'css', u'html', u'web'],
		'title': u'Webmaker Ljubljana',
		'user_email': u'*****@*****.**'
	}

	response_edited = admin_client.post(reverse('web.edit_event', args=[event.id]), event_data)

	assert response_edited.status_code == 200
	assert 'end_date' in response_edited.context['form'].errors

	event.delete()
コード例 #4
0
def test_edit_event_without_end_date(db, admin_user, admin_client):
    event = EventFactory.create(creator=admin_user)

    event_data = {
        "audience": [6, 7],
        "theme": [3, 4],
        "contact_person": u"*****@*****.**",
        "country": u"SI",
        "description": u"Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod\r\ntempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,\r\nquis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo\r\nconsequat. Duis aute irure dolor in reprehenderit in voluptate velit esse\r\ncillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non\r\nproident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
        "event_url": u"",
        "location": u"Ljubljana, Slovenia",
        "organizer": u"Mozilla Slovenija",
        "picture": "",
        "start_date": datetime.datetime.now(),
        "end_date": "",
        "tags": [u"css", u"html", u"web"],
        "title": u"Webmaker Ljubljana",
        "user_email": u"*****@*****.**",
    }

    response_edited = admin_client.post(reverse("web.edit_event", args=[event.id]), event_data)

    assert response_edited.status_code == 200
    assert "end_date" in response_edited.context["form"].errors

    event.delete()
コード例 #5
0
	def test_view_event_without_picture(self):
		test_event = EventFactory.create()
		response = self.client.get(reverse('web.view_event', args=[test_event.pk, test_event.slug]))

		assert response.status_code == 200
		assert test_event.title in response.content

		test_event.delete()
コード例 #6
0
	def test_view_event_without_picture(self):
		test_event = EventFactory.create()
		response = self.client.get(reverse('web.view_event', args=[test_event.pk, test_event.slug]))

		assert response.status_code == 200
		assert test_event.title in response.content

		test_event.delete()
コード例 #7
0
	def test_get_all_events_with_two_events(self):
		event = EventFactory.create()
		theme = EventTheme.objects.filter(pk=1)
		audience = EventAudience.objects.filter(pk=1)
		event.theme.add(*theme)
		event.audience.add(*audience)

		all_events = get_all_events()
		self.assertEqual(2, all_events.count())
コード例 #8
0
    def test_get_all_events_with_two_events(self):
        event = EventFactory.create()
        theme = EventTheme.objects.filter(pk=1)
        audience = EventAudience.objects.filter(pk=1)
        event.theme.add(*theme)
        event.audience.add(*audience)

        all_events = get_all_events()
        self.assertEqual(2, all_events.count())
コード例 #9
0
def test_search_show_only_approved(db, client):
    approved_event = ApprovedEventFactory.create()
    unapproved_event = EventFactory.create()

    response = client.get('/search/')

    assert approved_event.get_absolute_url() in response.content
    assert unapproved_event.get_absolute_url() not in response.content

    map(lambda x: x.delete(), [approved_event, unapproved_event])
コード例 #10
0
def test_search_show_only_approved(db, client):
    approved_event = ApprovedEventFactory.create()
    unapproved_event = EventFactory.create()

    response = client.get('/search/')

    assert approved_event.get_absolute_url() in response.content
    assert unapproved_event.get_absolute_url() not in response.content

    map(lambda x: x.delete(), [approved_event, unapproved_event])
コード例 #11
0
	def test_get_pending_events_limit_to_one_ordered_by_location_desc(self):
		event = EventFactory.create(title='test_get_pending_events_limit_to_one_ordered_by_location_desc',
					location='invalid location')
		theme = EventTheme.objects.filter(pk=1)
		audience = EventAudience.objects.filter(pk=1)

		event.theme.add(*theme)
		event.audience.add(*audience)
		event.save()

		pending = get_pending_events(limit=1, order='-location')
		self.assertEquals(1, pending.count())
		self.assertEquals('test_get_pending_events_limit_to_one_ordered_by_location_desc', pending[0].title)
コード例 #12
0
    def test_get_pending_events_limit_to_one_ordered_by_location_desc(self):
        event = EventFactory.create(
            title=
            'test_get_pending_events_limit_to_one_ordered_by_location_desc',
            location='invalid location')
        theme = EventTheme.objects.filter(pk=1)
        audience = EventAudience.objects.filter(pk=1)

        event.theme.add(*theme)
        event.audience.add(*audience)
        event.save()

        pending = get_pending_events(limit=1, order='-location')
        self.assertEquals(1, pending.count())
        self.assertEquals(
            'test_get_pending_events_limit_to_one_ordered_by_location_desc',
            pending[0].title)
コード例 #13
0
    def test_get_filtered_events_with_search_filter_searching_description_when_no_approved_event(
            self):
        event = EventFactory(
            description='Learn basics about programming in python')
        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)
        self.assertEquals(0, events.count())

        event.delete()
コード例 #14
0
	def test_event_with_empty_slug(self):
		event = EventFactory.create(title='#^^#')

		assert event.title == '#^^#'
		assert event.slug != ''
		assert event.slug == 'event'
コード例 #15
0
    def test_event_with_empty_slug(self):
        event = EventFactory.create(title='#^^#')

        assert event.title == '#^^#'
        assert event.slug != ''
        assert event.slug == 'event'