本文整理汇总了Python中tests.object_mother.ObjectMother.get_event方法的典型用法代码示例。如果您正苦于以下问题:Python ObjectMother.get_event方法的具体用法?Python ObjectMother.get_event怎么用?Python ObjectMother.get_event使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tests.object_mother.ObjectMother
的用法示例。
在下文中一共展示了ObjectMother.get_event方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_speakers_list
# 需要导入模块: from tests.object_mother import ObjectMother [as 别名]
# 或者: from tests.object_mother.ObjectMother import get_event [as 别名]
def test_speakers_list(self):
with app.test_request_context():
event = ObjectMother.get_event()
save_to_db(event, "Event saved")
url = url_for('event_speakers.index_view', event_id=event.id)
rv = self.app.get(url, follow_redirects=True)
self.assertTrue("Speakers" in rv.data, msg=rv.data)
示例2: test_event_copy
# 需要导入模块: from tests.object_mother import ObjectMother [as 别名]
# 或者: from tests.object_mother.ObjectMother import get_event [as 别名]
def test_event_copy(self):
with app.test_request_context():
event = ObjectMother.get_event()
save_to_db(event, "Event saved")
url = url_for('events.copy_event', event_id=event.id)
rv = self.app.get(url, follow_redirects=True)
self.assertTrue("Copy of event1" in rv.data, msg=rv.data)
示例3: test_events_edit
# 需要导入模块: from tests.object_mother import ObjectMother [as 别名]
# 或者: from tests.object_mother.ObjectMother import get_event [as 别名]
def test_events_edit(self):
with app.test_request_context():
event = ObjectMother.get_event()
save_to_db(event, "Event saved")
custom_forms = ObjectMother.get_custom_form(event.id)
save_to_db(custom_forms, "Custom forms saved")
url = url_for('events.edit_view', event_id=event.id)
data = POST_EVENT_DATA.copy()
del data['copyright']
data['sponsors[name]'] = ['Sponsor 1', 'Sponsor 2']
data['sponsors[type]'] = ['Gold', 'Silver']
data['sponsors[url]'] = ["", ""]
data['sponsors[description]'] = ["", ""]
data['sponsors[level]'] = ["", ""]
data['name'] = 'EditTestName'
data['start_date'] = '07/04/2016'
data['start_time'] = '19:00'
data['end_date'] = '07/04/2016'
data['end_time'] = '22:00'
data['custom_form[name]'] = ['session_form', 'speaker_form']
data['custom_form[value]'] = [custom_forms.session_form, custom_forms.speaker_form]
data = ImmutableMultiDict(data)
rv = self.app.post(url, follow_redirects=True, buffered=True, content_type='multipart/form-data',
data=data)
self.assertTrue('EditTestName' in rv.data, msg=rv.data)
self.assertTrue(data['sponsors[name]'] in rv.data, msg=rv.data)
示例4: test_wrong_form_config
# 需要导入模块: from tests.object_mother import ObjectMother [as 别名]
# 或者: from tests.object_mother.ObjectMother import get_event [as 别名]
def test_wrong_form_config(self):
with app.test_request_context():
event = ObjectMother.get_event()
save_to_db(event, "Event saved")
url = url_for('event_sessions.create_view', event_id=event.id)
rv = self.app.get(url, follow_redirects=True)
self.assertFalse("incorrectly configured" in rv.data, msg=rv.data)
示例5: test_event_delete
# 需要导入模块: from tests.object_mother import ObjectMother [as 别名]
# 或者: from tests.object_mother.ObjectMother import get_event [as 别名]
def test_event_delete(self):
with app.test_request_context():
event = ObjectMother.get_event()
save_to_db(event, "Event saved")
url = url_for('events.trash_view', event_id=event.id)
rv = self.app.get(url, follow_redirects=True)
self.assertTrue("Your event has been deleted" in rv.data, msg=rv.data)
示例6: test_scheduler_publish
# 需要导入模块: from tests.object_mother import ObjectMother [as 别名]
# 或者: from tests.object_mother.ObjectMother import get_event [as 别名]
def test_scheduler_publish(self):
with app.test_request_context():
event = ObjectMother.get_event()
save_to_db(event, "Event saved")
rv = self.app.get(url_for('event_scheduler.publish', event_id=event.id), follow_redirects=True)
event = DataGetter.get_event(event.id)
self.assertTrue(event.schedule_published_on is not None, msg=rv.data)
示例7: test_unpublished_event_view_attempt
# 需要导入模块: from tests.object_mother import ObjectMother [as 别名]
# 或者: from tests.object_mother.ObjectMother import get_event [as 别名]
def test_unpublished_event_view_attempt(self):
with app.test_request_context():
event = ObjectMother.get_event()
save_to_db(event, "Event Saved")
rv = self.app.get(url_for('event_detail.display_event_detail_home', event_id=event.id),
follow_redirects=True)
self.assertEqual(rv.status_code, 404)
示例8: test_published_event_view_coc
# 需要导入模块: from tests.object_mother import ObjectMother [as 别名]
# 或者: from tests.object_mother.ObjectMother import get_event [as 别名]
def test_published_event_view_coc(self):
with app.test_request_context():
event = ObjectMother.get_event()
event.state = 'Published'
save_to_db(event, "Event Saved")
rv = self.app.get(url_for('event_detail.display_event_coc', event_id=event.id),
follow_redirects=True)
self.assertTrue("Code of Conduct" in rv.data, msg=rv.data)
示例9: test_event_publish
# 需要导入模块: from tests.object_mother import ObjectMother [as 别名]
# 或者: from tests.object_mother.ObjectMother import get_event [as 别名]
def test_event_publish(self):
with app.test_request_context():
event = ObjectMother.get_event()
save_to_db(event, "Event saved")
url = url_for('events.publish_event', event_id=event.id)
rv = self.app.get(url, follow_redirects=True)
event = DataGetter.get_event(event.id)
self.assertEqual("Published", event.state, msg=event.state)
示例10: get_event
# 需要导入模块: from tests.object_mother import ObjectMother [as 别名]
# 或者: from tests.object_mother.ObjectMother import get_event [as 别名]
def get_event():
event = ObjectMother.get_event()
event.name = 'Super Event'
event.start_time = datetime.now() + timedelta(days=5)
event.end_time = event.start_time + timedelta(days=5)
event.location_name = 'India'
event.state = 'Published'
return event
示例11: test_api_tracks
# 需要导入模块: from tests.object_mother import ObjectMother [as 别名]
# 或者: from tests.object_mother.ObjectMother import get_event [as 别名]
def test_api_tracks(self):
self.assertEqual(self.app.get('/api/v1/event/1').status_code, 404)
event = ObjectMother.get_event()
track = ObjectMother.get_track()
with app.test_request_context():
save_to_db(event, "Event saved")
save_to_db(track, "Track saved")
self.assertEqual(self.app.get('/api/v1/event/1').status_code, 200)
self.assertEqual(self.app.get('/api/v1/event/1/tracks').status_code, 200)
示例12: test_event_delete
# 需要导入模块: from tests.object_mother import ObjectMother [as 别名]
# 或者: from tests.object_mother.ObjectMother import get_event [as 别名]
def test_event_delete(self):
with app.test_request_context():
event = ObjectMother.get_event()
register(self.app, u'[email protected]', u'test2')
login(self.app, '[email protected]', 'test2')
save_to_db(event, "Event saved")
url = url_for('events.delete_view', event_id=event.id)
rv = self.app.get(url, follow_redirects=True)
self.assertTrue("Forbidden" in rv.data, msg=rv.data)
示例13: test_published_event_view
# 需要导入模块: from tests.object_mother import ObjectMother [as 别名]
# 或者: from tests.object_mother.ObjectMother import get_event [as 别名]
def test_published_event_view(self):
with app.test_request_context():
event = ObjectMother.get_event()
event.state = "Published"
save_to_db(event, "Event Saved")
rv = self.app.get(
url_for("event_detail.display_event_detail_home", event_id=event.id), follow_redirects=True
)
self.assertTrue("Open Event" in rv.data, msg=rv.data)
示例14: test_session_reject
# 需要导入模块: from tests.object_mother import ObjectMother [as 别名]
# 或者: from tests.object_mother.ObjectMother import get_event [as 别名]
def test_session_reject(self):
with app.test_request_context():
event = ObjectMother.get_event()
save_to_db(event, "Event Saved")
session = ObjectMother.get_session()
save_to_db(session, "Session Saved")
url = url_for('event_sessions.reject_session', event_id=1, session_id=session.id)
rv = self.app.get(url, follow_redirects=True)
self.assertTrue("The session has been rejected" in rv.data, msg=rv.data)
示例15: setUp
# 需要导入模块: from tests.object_mother import ObjectMother [as 别名]
# 或者: from tests.object_mother.ObjectMother import get_event [as 别名]
def setUp(self):
self.app = Setup.create_app()
with app.test_request_context():
event = ObjectMother.get_event()
event.owner = 1
track = ObjectMother.get_track()
save_to_db(event,"Event saved")
save_to_db(track, "Track saved")
register(self.app,'test', '[email protected]', 'test')