当前位置: 首页>>代码示例>>Python>>正文


Python ObjectMother.get_session方法代码示例

本文整理汇总了Python中tests.object_mother.ObjectMother.get_session方法的典型用法代码示例。如果您正苦于以下问题:Python ObjectMother.get_session方法的具体用法?Python ObjectMother.get_session怎么用?Python ObjectMother.get_session使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tests.object_mother.ObjectMother的用法示例。


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

示例1: test_session_delete

# 需要导入模块: from tests.object_mother import ObjectMother [as 别名]
# 或者: from tests.object_mother.ObjectMother import get_session [as 别名]
 def test_session_delete(self):
     with app.test_request_context():
         session = ObjectMother.get_session()
         save_to_db(session, "Session Saved")
         url = url_for('event_sessions.delete_session', event_id=1, session_id=session.id)
         rv = self.app.get(url, follow_redirects=True)
         self.assertTrue("deleted" in rv.data, msg=rv.data)
开发者ID:hacktrec,项目名称:open-event-orga-server,代码行数:9,代码来源:test_session.py

示例2: test_sessions_list

# 需要导入模块: from tests.object_mother import ObjectMother [as 别名]
# 或者: from tests.object_mother.ObjectMother import get_session [as 别名]
 def test_sessions_list(self):
     with app.test_request_context():
         event = ObjectMother.get_event()
         save_to_db(event, "Event saved")
         session = ObjectMother.get_session(event.id)
         save_to_db(session, "Session Saved")
         url = url_for('event_sessions.index_view', event_id=event.id, session_id=session.id)
         rv = self.app.get(url, follow_redirects=True)
         self.assertTrue("Sessions" in rv.data, msg=rv.data)
开发者ID:deepakpathania,项目名称:open-event-orga-server,代码行数:11,代码来源:test_session.py

示例3: test_session_reject

# 需要导入模块: from tests.object_mother import ObjectMother [as 别名]
# 或者: from tests.object_mother.ObjectMother import get_session [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)
开发者ID:hacktrec,项目名称:open-event-orga-server,代码行数:11,代码来源:test_session.py

示例4: test_session_view

# 需要导入模块: from tests.object_mother import ObjectMother [as 别名]
# 或者: from tests.object_mother.ObjectMother import get_session [as 别名]
 def test_session_view(self):
     with app.test_request_context():
         event = ObjectMother.get_event()
         save_to_db(event)
         session = ObjectMother.get_session()
         session.event_id = event.id
         save_to_db(session, "Session Saved")
         url = url_for('event_sessions.session_display_view', event_id=event.id, session_id=session.id)
         rv = self.app.get(url, follow_redirects=True)
         self.assertTrue("Short abstract" in rv.data, msg=rv.data)
开发者ID:hacktrec,项目名称:open-event-orga-server,代码行数:12,代码来源:test_session.py

示例5: basic_setup

# 需要导入模块: from tests.object_mother import ObjectMother [as 别名]
# 或者: from tests.object_mother.ObjectMother import get_session [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
开发者ID:hacktrec,项目名称:open-event-orga-server,代码行数:12,代码来源:test_settings.py

示例6: test_session_edit

# 需要导入模块: from tests.object_mother import ObjectMother [as 别名]
# 或者: from tests.object_mother.ObjectMother import get_session [as 别名]
 def test_session_edit(self):
     with app.test_request_context():
         event = ObjectMother.get_event()
         save_to_db(event, "Event saved")
         custom_form = ObjectMother.get_custom_form(event.id)
         save_to_db(custom_form, "Custom form saved")
         session = ObjectMother.get_session(event.id)
         save_to_db(session, "Session saved")
         url = url_for('event_sessions.edit_view', event_id=event.id, session_id=session.id)
         rv = self.app.get(url, follow_redirects=True)
         self.assertTrue("Edit Session" in rv.data, msg=rv.data)
开发者ID:hacktrec,项目名称:open-event-orga-server,代码行数:13,代码来源:test_session.py

示例7: test_session_edit_post

# 需要导入模块: from tests.object_mother import ObjectMother [as 别名]
# 或者: from tests.object_mother.ObjectMother import get_session [as 别名]
 def test_session_edit_post(self):
     with app.test_request_context():
         event = ObjectMother.get_event()
         save_to_db(event, "Event saved")
         custom_form = ObjectMother.get_custom_form(event.id)
         save_to_db(custom_form, "Custom form saved")
         session = ObjectMother.get_session(event.id)
         save_to_db(session, "Session saved")
         data = POST_SESSION_DATA
         data['title'] = 'TestSession2'
         url = url_for('event_sessions.edit_view', event_id=event.id, session_id=session.id)
         rv = self.app.post(url, follow_redirects=True, buffered=True, content_type='multipart/form-data', data=data)
         self.assertTrue("TestSession2" in rv.data, msg=rv.data)
开发者ID:hacktrec,项目名称:open-event-orga-server,代码行数:15,代码来源:test_session.py

示例8: test_published_event_sessions_view

# 需要导入模块: from tests.object_mother import ObjectMother [as 别名]
# 或者: from tests.object_mother.ObjectMother import get_session [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', event_id=event.id), follow_redirects=True)
         self.assertTrue("Sessions" in rv.data, msg=rv.data)
开发者ID:agwisniewska,项目名称:open-event-orga-server,代码行数:19,代码来源:test_guest_event_page.py

示例9: test_published_event_unpublished_schedule_view_attempt

# 需要导入模块: from tests.object_mother import ObjectMother [as 别名]
# 或者: from tests.object_mother.ObjectMother import get_session [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', event_id=event.id), follow_redirects=True)
         self.assertEqual(rv.status_code, 404)
开发者ID:agwisniewska,项目名称:open-event-orga-server,代码行数:22,代码来源:test_guest_event_page.py

示例10: test_published_event_schedule_view

# 需要导入模块: from tests.object_mother import ObjectMother [as 别名]
# 或者: from tests.object_mother.ObjectMother import get_session [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.microlocation_id = microlocation.id
         session.speakers = [speaker]
         save_to_db(speaker, "Session Saved")
         rv = self.app.get(url_for("event_detail.display_event_schedule", event_id=event.id), follow_redirects=True)
         self.assertTrue("Schedule" in rv.data, msg=rv.data)
开发者ID:yasharmaster,项目名称:open-event-orga-server,代码行数:23,代码来源:test_guest_event_page.py

示例11: test_add_session_type_to_db

# 需要导入模块: from tests.object_mother import ObjectMother [as 别名]
# 或者: from tests.object_mother.ObjectMother import get_session [as 别名]
 def test_add_session_type_to_db(self):
     """Checks the one to many relationship between event and session_types and
             the one to one relationship between session and session_types"""
     self.app = Setup.create_app()
     with app.test_request_context():
         event = ObjectMother.get_event()
         session1 = ObjectMother.get_session()
         session2 = Session(title='test2',
                            description='dsadsd',
                            start_time=datetime(2003, 8, 4, 12, 30, 45),
                            end_time=datetime(2003, 8, 4, 12, 30, 45))
         session_type1 = SessionType(name='Type1', length='30', event_id='1', session_id='1')
         session_type2 = SessionType(name='Type2', length='30', event_id='1', session_id='2')
         save_to_db(event, "Event Saved")
         save_to_db(session1, "Session1 Saved")
         save_to_db(session2, "Session2 Saved")
         save_to_db(session_type1, "SessionType1 Saved")
         save_to_db(session_type2, "SessionType2 Saved")
         self.assertEqual(session_type1.event_id, 1)
         self.assertEqual(session_type2.event_id, 1)
         self.assertEqual(session_type1.session_id, 1)
         self.assertEqual(session_type2.session_id, 2)
开发者ID:shivamMg,项目名称:open-event-orga-server,代码行数:24,代码来源:test_session_type.py

示例12: test_get_session_by_id

# 需要导入模块: from tests.object_mother import ObjectMother [as 别名]
# 或者: from tests.object_mother.ObjectMother import get_session [as 别名]
 def test_get_session_by_id(self):
     session = ObjectMother.get_session()
     with app.test_request_context():
         save_to_db(session, "Session saved")
         response = self.app.get('/api/v1/event/sessions/1')
         self.assertEqual(response.status_code, 200)
开发者ID:hacktrec,项目名称:open-event-orga-server,代码行数:8,代码来源:test_get_session_by_id.py

示例13: test_add_session_to_db

# 需要导入模块: from tests.object_mother import ObjectMother [as 别名]
# 或者: from tests.object_mother.ObjectMother import get_session [as 别名]
 def test_add_session_to_db(self):
     session = ObjectMother.get_session()
     with app.test_request_context():
         save_to_db(session, "Session saved")
         self.assertEqual(session.id, 1)
开发者ID:aayusharora,项目名称:open-event-orga-server,代码行数:7,代码来源:test_session.py


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