本文整理汇总了Python中tests.unittests.object_mother.ObjectMother.get_speaker方法的典型用法代码示例。如果您正苦于以下问题:Python ObjectMother.get_speaker方法的具体用法?Python ObjectMother.get_speaker怎么用?Python ObjectMother.get_speaker使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tests.unittests.object_mother.ObjectMother
的用法示例。
在下文中一共展示了ObjectMother.get_speaker方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_wrong_form_config
# 需要导入模块: from tests.unittests.object_mother import ObjectMother [as 别名]
# 或者: from tests.unittests.object_mother.ObjectMother import get_speaker [as 别名]
def test_wrong_form_config(self):
with app.test_request_context():
event = ObjectMother.get_event()
save_to_db(event, "Event saved")
speaker = ObjectMother.get_speaker()
speaker.event_id = event.id
save_to_db(speaker, "Speaker saved")
url = url_for('event_speakers.edit_view', event_id=event.id, speaker_id=speaker.id)
rv = self.app.get(url, follow_redirects=True)
self.assertFalse("incorrectly configured" in rv.data, msg=rv.data)
示例2: basic_setup
# 需要导入模块: from tests.unittests.object_mother import ObjectMother [as 别名]
# 或者: from tests.unittests.object_mother.ObjectMother import get_speaker [as 别名]
def basic_setup(super_admin):
event = ObjectMother.get_event()
save_to_db(event, "Event saved")
session = ObjectMother.get_session(event.id)
save_to_db(session, "Session saved")
speaker = ObjectMother.get_speaker()
speaker.event_id = event.id
speaker.user_id = super_admin.id
save_to_db(speaker, "Speaker saved")
return event
示例3: test_speaker_delete
# 需要导入模块: from tests.unittests.object_mother import ObjectMother [as 别名]
# 或者: from tests.unittests.object_mother.ObjectMother import get_speaker [as 别名]
def test_speaker_delete(self):
with app.test_request_context():
event = ObjectMother.get_event()
save_to_db(event, "Event saved")
speaker = ObjectMother.get_speaker()
speaker.event_id = event.id
save_to_db(speaker, "Session Saved")
url = url_for('event_speakers.delete', event_id=event.id, speaker_id=speaker.id)
rv = self.app.get(url, follow_redirects=True)
self.assertTrue("deleted" in rv.data, msg=rv.data)
示例4: test_speaker_view
# 需要导入模块: from tests.unittests.object_mother import ObjectMother [as 别名]
# 或者: from tests.unittests.object_mother.ObjectMother import get_speaker [as 别名]
def test_speaker_view(self):
with app.test_request_context():
event = ObjectMother.get_event()
save_to_db(event, "Event saved")
speaker = ObjectMother.get_speaker()
speaker.event_id = event.id
save_to_db(speaker, "Speaker saved")
custom_forms = ObjectMother.get_custom_form()
custom_forms.event_id = event.id
save_to_db(custom_forms, "Custom forms Saved")
url = url_for('event_speakers.edit_view', event_id=event.id, speaker_id=speaker.id)
rv = self.app.get(url, follow_redirects=True)
self.assertTrue("name" in rv.data, msg=rv.data)
示例5: test_published_event_sessions_view
# 需要导入模块: from tests.unittests.object_mother import ObjectMother [as 别名]
# 或者: from tests.unittests.object_mother.ObjectMother import get_speaker [as 别名]
def test_published_event_sessions_view(self):
with app.test_request_context():
event = ObjectMother.get_event()
event.state = 'Published'
save_to_db(event, "Event Saved")
track = ObjectMother.get_track()
track.event_id = event.id
save_to_db(track, "Track Saved")
speaker = ObjectMother.get_speaker()
speaker.event_id = event.id
save_to_db(speaker, "Speaker Saved")
session = ObjectMother.get_session()
session.event_id = event.id
session.speakers = [speaker]
save_to_db(speaker, "Session Saved")
rv = self.app.get(url_for('event_detail.display_event_sessions', identifier=event.identifier),
follow_redirects=True)
self.assertTrue("Sessions" in rv.data, msg=rv.data)
示例6: test_published_event_unpublished_schedule_view_attempt
# 需要导入模块: from tests.unittests.object_mother import ObjectMother [as 别名]
# 或者: from tests.unittests.object_mother.ObjectMother import get_speaker [as 别名]
def test_published_event_unpublished_schedule_view_attempt(self):
with app.test_request_context():
event = ObjectMother.get_event()
event.state = 'Published'
save_to_db(event, "Event Saved")
track = ObjectMother.get_track()
track.event_id = event.id
save_to_db(track, "Track Saved")
speaker = ObjectMother.get_speaker()
speaker.event_id = event.id
save_to_db(speaker, "Speaker Saved")
microlocation = ObjectMother.get_microlocation()
save_to_db(microlocation, "Microlocation Saved")
session = ObjectMother.get_session()
session.event_id = event.id
session.microlocation_id = microlocation.id
session.speakers = [speaker]
save_to_db(speaker, "Session Saved")
rv = self.app.get(url_for('event_detail.display_event_schedule', identifier=event.identifier),
follow_redirects=True)
self.assertEqual(rv.status_code, 404)
示例7: test_speaker_edit
# 需要导入模块: from tests.unittests.object_mother import ObjectMother [as 别名]
# 或者: from tests.unittests.object_mother.ObjectMother import get_speaker [as 别名]
def test_speaker_edit(self):
with app.test_request_context():
event = ObjectMother.get_event()
save_to_db(event, "Event saved")
speaker = ObjectMother.get_speaker()
speaker.event_id = event.id
save_to_db(speaker, "Speaker saved")
custom_forms = ObjectMother.get_custom_form()
custom_forms.event_id = event.id
save_to_db(custom_forms, "Custom forms Saved")
url = url_for('event_speakers.edit_view', event_id=event.id, speaker_id=speaker.id)
rv = self.app.post(url, data=dict(
name='name2',
email='[email protected]',
organisation="FOSSASIA2",
country="India2"
), follow_redirects=True)
self.assertTrue("Speaker has been saved" in rv.data, msg=rv.data)
url = url_for('event_speakers.edit_view', event_id=event.id, speaker_id=speaker.id)
rv = self.app.get(url, follow_redirects=True)
self.assertTrue("name2" in rv.data, msg=rv.data)
示例8: test_published_event_schedule_view
# 需要导入模块: from tests.unittests.object_mother import ObjectMother [as 别名]
# 或者: from tests.unittests.object_mother.ObjectMother import get_speaker [as 别名]
def test_published_event_schedule_view(self):
with app.test_request_context():
event = ObjectMother.get_event()
event.state = 'Published'
event.schedule_published_on = datetime.now()
save_to_db(event, "Event Saved")
track = ObjectMother.get_track()
track.event_id = event.id
save_to_db(track, "Track Saved")
speaker = ObjectMother.get_speaker()
speaker.event_id = event.id
save_to_db(speaker, "Speaker Saved")
microlocation = ObjectMother.get_microlocation()
save_to_db(microlocation, "Microlocation Saved")
session = ObjectMother.get_session()
session.event_id = event.id
session.state = 'accepted'
session.microlocation_id = microlocation.id
session.speakers = [speaker]
save_to_db(session, "Session Saved")
rv = self.app.get(url_for('event_detail.display_event_schedule', identifier=event.identifier),
follow_redirects=True)
self.assertTrue("Schedule" in rv.data, msg=rv.data)
示例9: test_get_speaker_by_id
# 需要导入模块: from tests.unittests.object_mother import ObjectMother [as 别名]
# 或者: from tests.unittests.object_mother.ObjectMother import get_speaker [as 别名]
def test_get_speaker_by_id(self):
speaker = ObjectMother.get_speaker()
with app.test_request_context():
save_to_db(speaker, "Speaker saved")
response = self.app.get('/api/v1/event/speakers/1')
self.assertEqual(response.status_code,200)