本文整理汇总了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;未经允许,请勿转载。 |
请发表评论