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

Python object_mother.ObjectMother类代码示例

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

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



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

示例1: test_events_edit

 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)
开发者ID:agwisniewska,项目名称:open-event-orga-server,代码行数:26,代码来源:test_events.py


示例2: setUp

 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')
开发者ID:championswimmer,项目名称:open-event-orga-server,代码行数:9,代码来源:test_event_track.py


示例3: test_sessions_list

 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,代码行数:9,代码来源:test_session.py


示例4: test_session_create

 def test_session_create(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")
         url = url_for('event_sessions.create_view', event_id=event.id)
         rv = self.app.get(url, follow_redirects=True)
         self.assertTrue("Create Session" in rv.data, msg=rv.data)
开发者ID:hacktrec,项目名称:open-event-orga-server,代码行数:9,代码来源:test_session.py


示例5: test_api_tracks

 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)
开发者ID:hacktrec,项目名称:open-event-orga-server,代码行数:9,代码来源:test_api.py


示例6: test_session_reject

 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,代码行数:9,代码来源:test_session.py


示例7: test_wrong_form_config

 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)
开发者ID:agwisniewska,项目名称:open-event-orga-server,代码行数:10,代码来源:test_speakers.py


示例8: test_speaker_delete

 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)
开发者ID:agwisniewska,项目名称:open-event-orga-server,代码行数:10,代码来源:test_speakers.py


示例9: test_session_view

 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,代码行数:10,代码来源:test_session.py


示例10: basic_setup

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,代码行数:10,代码来源:test_settings.py


示例11: test_session_create_post

 def test_session_create_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")
         data = POST_SESSION_DATA
         data.update(POST_SPEAKER_DATA)
         url = url_for('event_sessions.create_view', event_id=event.id)
         rv = self.app.post(url, follow_redirects=True, buffered=True, content_type='multipart/form-data', data=data)
         self.assertTrue(data['title'] in rv.data, msg=rv.data)
开发者ID:hacktrec,项目名称:open-event-orga-server,代码行数:11,代码来源:test_session.py


示例12: test_api_tracks

 def test_api_tracks(self):
     with self.assertRaises(Exception) as context:
         self.app.get('/api/v1/event/1')
     self.assertTrue(AttributeError, context.exception)
     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)
开发者ID:shauntrick,项目名称:open-event-orga-server,代码行数:11,代码来源:test_api.py


示例13: test_speaker_view

 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)
开发者ID:agwisniewska,项目名称:open-event-orga-server,代码行数:13,代码来源:test_speakers.py


示例14: test_session_edit_post

 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,代码行数:13,代码来源:test_session.py


示例15: test_role_delete

 def test_role_delete(self):
     with app.test_request_context():
         event = ObjectMother.get_event()
         event.creator = self.super_admin
         save_to_db(event, "Event saved")
         user = ObjectMother.get_user()
         save_to_db(user, "New user saved")
         populate()
         role = Role.query.filter_by(name='coorganizer').first()
         uer = UsersEventsRoles(user, event, role)
         save_to_db(uer, "UER Saved")
         rv = self.app.get(url_for('event_roles.delete_view', uer_id=uer.id, event_id=event.id), follow_redirects=True)
         uer = UsersEventsRoles.query.get(uer.id)
         self.assertTrue(uer is None, msg=rv.data)
开发者ID:hacktrec,项目名称:open-event-orga-server,代码行数:14,代码来源:test_roles.py


示例16: test_event_view

 def test_event_view(self):
     with app.test_request_context():
         event = ObjectMother.get_event()
         save_to_db(event, "Event saved")
         url = url_for('events.details_view', event_id=event.id)
         rv = self.app.get(url, follow_redirects=True)
         self.assertTrue("event1" in rv.data, msg=rv.data)
         microlocation = ObjectMother.get_microlocation(event_id=event.id)
         track = ObjectMother.get_track(event_id=event.id)
         cfs = ObjectMother.get_cfs(event_id=event.id)
         save_to_db(track, "Track saved")
         save_to_db(microlocation, "Microlocation saved")
         save_to_db(cfs, "Call for speakers saved")
         rv = self.app.get(url, follow_redirects=True)
         self.assertTrue("event1" in rv.data, msg=rv.data)
开发者ID:agwisniewska,项目名称:open-event-orga-server,代码行数:15,代码来源:test_events.py


示例17: test_scheduler_publish

 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)
开发者ID:agwisniewska,项目名称:open-event-orga-server,代码行数:7,代码来源:test_scheduler.py


示例18: test_event_copy

 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)
开发者ID:agwisniewska,项目名称:open-event-orga-server,代码行数:7,代码来源:test_events.py


示例19: test_event_delete

 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)
开发者ID:agwisniewska,项目名称:open-event-orga-server,代码行数:7,代码来源:test_events.py


示例20: test_wrong_form_config

 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)
开发者ID:hacktrec,项目名称:open-event-orga-server,代码行数:7,代码来源:test_session.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python helper.APITestHelper类代码示例发布时间:2022-05-27
下一篇:
Python mr_word_count.MRWordCount类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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