• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python tests.ApprovedEventFactory类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中web.tests.ApprovedEventFactory的典型用法代码示例。如果您正苦于以下问题:Python ApprovedEventFactory类的具体用法?Python ApprovedEventFactory怎么用?Python ApprovedEventFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了ApprovedEventFactory类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_search_with_audience_multiple_events

def test_search_with_audience_multiple_events(db, client):
    approved1 = ApprovedEventFactory.create(
        title="Event Arglebargle - Approved",
        country="SI")  # default audience 1
    approved2 = ApprovedEventFactory.create(
        title="Event Arglebargle - Approved",
        country="SI",
        audience=[
            1,
            2])
    approved3 = ApprovedEventFactory.create(
        title="Event Arglebargle - Approved",
        country="AT",
        audience=[
            1,
            2])
    approved4 = ApprovedEventFactory.create(
        title="Event Arglebargle - Approved", country="SI", audience=[3])
    response = client.get(
        reverse('web.search_events'), {
            'audience': 1}, REMOTE_ADDR='93.103.53.11')

    assert approved1.get_absolute_url() in response.content
    assert approved2.get_absolute_url() in response.content
    assert approved3.get_absolute_url() not in response.content
    assert approved4.get_absolute_url() not in response.content

    map(lambda x: x.delete(), [approved1, approved2, approved3, approved4])
开发者ID:AmericanSundown,项目名称:coding-events,代码行数:28,代码来源:test_event_search.py


示例2: test_search_with_theme_multiple_events_all_countries

def test_search_with_theme_multiple_events_all_countries(db, client):
	approved1 = ApprovedEventFactory.create(title="Event Arglebargle - Approved", country="SI")
	approved2 = ApprovedEventFactory.create(title="Event Arglebargle - Approved", country="AT")
	response = client.get(reverse('web.search_events'), {'country':'00', 'theme':1}, REMOTE_ADDR='93.103.53.11')

	assert approved1.get_absolute_url() in response.content
	assert approved2.get_absolute_url() in response.content

	map(lambda x: x.delete(), [approved1, approved2])
开发者ID:ercchy,项目名称:coding-events,代码行数:9,代码来源:test_event_search.py


示例3: test_search_events_with_search_query_multiple_events_current_country_only

def test_search_events_with_search_query_multiple_events_current_country_only(db, client):
	approved1 = ApprovedEventFactory.create(title="Event Arglebargle - Approved", country="SI")
	approved2 = ApprovedEventFactory.create(title="Event Arglebargle - Approved", country="AT")

	response = client.get(reverse('web.search_events'), {'q':'arglebargle'}, REMOTE_ADDR='93.103.53.11')

	assert approved1.get_absolute_url() in response.content
	assert approved2.get_absolute_url() not in response.content

	map(lambda x: x.delete(), [approved1, approved2])
开发者ID:ercchy,项目名称:coding-events,代码行数:10,代码来源:test_event_search.py


示例4: test_search_events_with_search_query_all_countries_multiple_results

	def test_search_events_with_search_query_all_countries_multiple_results(self):
		approved1 = ApprovedEventFactory.create(title="Event Arglebargle - Approved", country="SI")
		approved2 = ApprovedEventFactory.create(title="Event Arglebargle - Approved", country="AT")

		response = self.client.get(reverse('web.search_events'), {'q':'arglebargle', 'country_code':'00'}, REMOTE_ADDR='93.103.53.11')

		self.assertEquals(2,response.context['events'].count())

		approved1.delete()
		approved2.delete()
开发者ID:friedger,项目名称:coding-events,代码行数:10,代码来源:test_event_views.py


示例5: test_search_events_with_search_query_multiple_events

    def test_search_events_with_search_query_multiple_events(self):
        approved1 = ApprovedEventFactory.create(title="Event Arglebargle - Approved", country="SI")
        approved2 = ApprovedEventFactory.create(title="Event Arglebargle - Approved", country="AT")

        response = self.client.get(reverse("web.search_events"), {"q": "arglebargle"}, REMOTE_ADDR="93.103.53.11")

        self.assertEquals(1, response.context["events"].count())
        self.assertEquals("SI", response.context["country"])

        approved1.delete()
        approved2.delete()
开发者ID:michelesr,项目名称:coding-events,代码行数:11,代码来源:test_event_views.py


示例6: test_get_filtered_events_with_search_filter_searching_description

	def test_get_filtered_events_with_search_filter_searching_description(self):
		event = ApprovedEventFactory(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(1, events.count())
		self.assertEquals(2, events[0].pk)

		event.delete()
开发者ID:NinaKos,项目名称:coding-events,代码行数:14,代码来源:test_processors.py


示例7: test_search_events_with_unicode_tag_in_search_query

def test_search_events_with_unicode_tag_in_search_query(db, client):
	approved1 = ApprovedEventFactory.create(tags=[u"jabolčna čežana",u"José", "Django"])
	response = client.get(reverse('web.search_events'), {'q':'čežana'}, REMOTE_ADDR='93.103.53.11')

	assert approved1.get_absolute_url() in response.content

	approved1.delete()
开发者ID:ercchy,项目名称:coding-events,代码行数:7,代码来源:test_event_search.py


示例8: test_search_events_with_search_query

def test_search_events_with_search_query(db, client):
	approved1 = ApprovedEventFactory.create(title='Event Arglebargle - Approved')
	response = client.get(reverse('web.search_events'), {'q':'arglebargle'}, REMOTE_ADDR='93.103.53.11')

	assert approved1.get_absolute_url() in response.content

	approved1.delete()
开发者ID:ercchy,项目名称:coding-events,代码行数:7,代码来源:test_event_search.py


示例9: test_search_with_theme

def test_search_with_theme(db, client):
	approved1 = ApprovedEventFactory.create(title="Event Arglebargle - Approved", country="SI", theme=[2])
	response = client.get(reverse('web.search_events'), {'theme':2}, REMOTE_ADDR='93.103.53.11')

	assert approved1.get_absolute_url() in response.content

	approved1.delete()
开发者ID:ercchy,项目名称:coding-events,代码行数:7,代码来源:test_event_search.py


示例10: test_search_events_search_in_wrong_location_again

def test_search_events_search_in_wrong_location_again(db, client):
    approved1 = ApprovedEventFactory.create(
        title='Event Arglebargle - Approved')
    response = client.get(
        reverse('web.search_events'), {
            'q': 'Celovška 1'}, REMOTE_ADDR='93.103.53.11')

    assert approved1.get_absolute_url() not in response.content
    approved1.delete()
开发者ID:AmericanSundown,项目名称:coding-events,代码行数:9,代码来源:test_event_search.py


示例11: test_search_show_only_approved

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])
开发者ID:AmericanSundown,项目名称:coding-events,代码行数:10,代码来源:test_event_search.py


示例12: test_search_show_past_events

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])
开发者ID:AmericanSundown,项目名称:coding-events,代码行数:10,代码来源:test_event_search.py


示例13: test_get_filtered_events_with_no_search_filter

	def test_get_filtered_events_with_no_search_filter(self):
		event = ApprovedEventFactory.create(title='test_get_filtered_events_with_no_search_filter')
		theme = EventTheme.objects.filter(pk=1)
		audience = EventAudience.objects.filter(pk=1)
		event.theme.add(*theme)
		event.audience.add(*audience)
		event.save()

		events = get_filtered_events()
		self.assertEquals('test_get_filtered_events_with_no_search_filter', events[0].title)

		event.delete()
开发者ID:NinaKos,项目名称:coding-events,代码行数:12,代码来源:test_processors.py


示例14: test_get_all_events_with_different_statuses

	def test_get_all_events_with_different_statuses(self):
		event = ApprovedEventFactory.create()
		theme = EventTheme.objects.filter(pk=1)
		audience = EventAudience.objects.filter(pk=1)

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

		self.assertEqual('PENDING', get_event_by_id(1).status)
		self.assertEqual('APPROVED', event.status)

		all_events = get_all_events()
		self.assertEqual(2, all_events.count())
开发者ID:NinaKos,项目名称:coding-events,代码行数:14,代码来源:test_processors.py


示例15: test_get_filtered_events_with_search_filter_searching_organizer

	def test_get_filtered_events_with_search_filter_searching_organizer(self):
		event = ApprovedEventFactory.create(organizer='CodeCatz')
		theme = EventTheme.objects.filter(pk=1)
		audience = EventAudience.objects.filter(pk=1)
		event.theme.add(*theme)
		event.audience.add(*audience)
		event.save()

		search_filter = "Catz"
		events = get_filtered_events(search_filter=search_filter)
		self.assertEquals(1, events.count())
		self.assertEquals('CodeCatz', events[0].organizer)

		event.delete()
开发者ID:NinaKos,项目名称:coding-events,代码行数:14,代码来源:test_processors.py


示例16: test_get_filtered_events_with_search_filter_searching_title

	def test_get_filtered_events_with_search_filter_searching_title(self):
		event = ApprovedEventFactory.create(title='Programming for dummies')
		theme = EventTheme.objects.filter(pk=1)
		audience = EventAudience.objects.filter(pk=1)
		event.theme.add(*theme)
		event.audience.add(*audience)
		event.save()

		search_filter = "dummies"
		events = get_filtered_events(search_filter=search_filter)
		self.assertEquals(1, events.count())
		self.assertEquals('Programming for dummies', events[0].title)

		event.delete()
开发者ID:NinaKos,项目名称:coding-events,代码行数:14,代码来源:test_processors.py


示例17: test_get_filtered_events_with_theme_filter_and_audience_filter_with_more_approved_event

	def test_get_filtered_events_with_theme_filter_and_audience_filter_with_more_approved_event(self):
		event = ApprovedEventFactory.create()
		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()
		theme_filter = EventTheme.objects.filter(pk=1)
		audience_filter = EventAudience.objects.filter(pk=1)
		events = get_filtered_events(theme_filter=theme_filter, audience_filter=audience_filter)
		self.assertEquals(2, events.count())
开发者ID:NinaKos,项目名称:coding-events,代码行数:15,代码来源:test_processors.py


示例18: test_search_events_with_unicode_tag_in_search_query

    def test_search_events_with_unicode_tag_in_search_query(self):
        ApprovedEventFactory.create(tags=["jabolčna čežana", "José", "Django"])
        response = self.client.get(reverse("web.search_events"), {"q": "čežana"}, REMOTE_ADDR="93.103.53.11")

        self.assertEquals(1, response.context["events"].count())
        self.assertEquals("SI", response.context["country"])
开发者ID:michelesr,项目名称:coding-events,代码行数:6,代码来源:test_event_views.py


示例19: test_search_events_with_search_query

	def test_search_events_with_search_query(self):
		ApprovedEventFactory.create(title='Event Arglebargle - Approved')
		response = self.client.get(reverse('web.search_events'), {'q':'arglebargle'}, REMOTE_ADDR='93.103.53.11')

		self.assertEquals(1,response.context['events'].count())
		self.assertEquals('SI', response.context['country'])
开发者ID:friedger,项目名称:coding-events,代码行数:6,代码来源:test_event_views.py


示例20: test_search_events_with_unicode_tag_in_search_query

	def test_search_events_with_unicode_tag_in_search_query(self):
		ApprovedEventFactory.create(tags=["jabolčna čežana","José", "Django"])
		response = self.client.get(reverse('web.search_events'), {'q':'čežana'}, REMOTE_ADDR='93.103.53.11')

		self.assertEquals(1,response.context['events'].count())
		self.assertEquals('SI', response.context['country'])
开发者ID:friedger,项目名称:coding-events,代码行数:6,代码来源:test_event_views.py



注:本文中的web.tests.ApprovedEventFactory类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python web3.Web3类代码示例发布时间:2022-05-26
下一篇:
Python event.create_or_update_event函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap