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


Python ObjectMother.get_custom_form方法代码示例

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


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

示例1: test_events_edit

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

示例2: test_events_create_post

# 需要导入模块: from tests.object_mother import ObjectMother [as 别名]
# 或者: from tests.object_mother.ObjectMother import get_custom_form [as 别名]
    def test_events_create_post(self):
        with app.test_request_context():
            custom_forms = ObjectMother.get_custom_form()
            url = url_for('events.create_view')
            data = POST_EVENT_DATA.copy()
            del data['copyright']
            data['sponsors_state'] = 'on'
            data['sponsors[name]'] = ['Sponsor 1', 'Sponsor 2']
            data['sponsors[type]'] = ['Gold', 'Silver']
            data['sponsors[url]'] = ["", ""]
            data['sponsors[description]'] = ["", ""]
            data['sponsors[level]'] = ["", ""]
            data['start_date'] = '07/04/2016'
            data['start_time'] = '19:00'
            data['end_date'] = '07/04/2016'
            data['end_time'] = '22:00'
            data['has_session_speakers'] = 'no'
            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(POST_EVENT_DATA['name'] in rv.data, msg=rv.data)

            rv2 = self.app.get(url_for('events.details_view', event_id=1))
            self.assertTrue(data['sponsors[name]'] in rv2.data, msg=rv2.data)
开发者ID:hacktrec,项目名称:open-event-orga-server,代码行数:28,代码来源:test_events.py

示例3: test_session_create

# 需要导入模块: from tests.object_mother import ObjectMother [as 别名]
# 或者: from tests.object_mother.ObjectMother import get_custom_form [as 别名]
 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,代码行数:11,代码来源:test_session.py

示例4: test_session_create_post

# 需要导入模块: from tests.object_mother import ObjectMother [as 别名]
# 或者: from tests.object_mother.ObjectMother import get_custom_form [as 别名]
 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,代码行数:13,代码来源:test_session.py

示例5: test_session_edit_post

# 需要导入模块: from tests.object_mother import ObjectMother [as 别名]
# 或者: from tests.object_mother.ObjectMother import get_custom_form [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

示例6: test_speaker_view

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

示例7: test_events_create_post

# 需要导入模块: from tests.object_mother import ObjectMother [as 别名]
# 或者: from tests.object_mother.ObjectMother import get_custom_form [as 别名]
 def test_events_create_post(self):
     with app.test_request_context():
         custom_forms = ObjectMother.get_custom_form()
         url = url_for('events.create_view')
         data = POST_EVENT_DATA
         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]
         rv = self.app.post(url, follow_redirects=True, buffered=True, content_type='multipart/form-data',
                            data=data)
         self.assertTrue(POST_EVENT_DATA['name'] in rv.data, msg=rv.data)
开发者ID:deepakpathania,项目名称:open-event-orga-server,代码行数:16,代码来源:test_events.py

示例8: test_events_create_post_publish_without_location_attempt

# 需要导入模块: from tests.object_mother import ObjectMother [as 别名]
# 或者: from tests.object_mother.ObjectMother import get_custom_form [as 别名]
 def test_events_create_post_publish_without_location_attempt(self):
     with app.test_request_context():
         custom_forms = ObjectMother.get_custom_form()
         url = url_for('events.create_view')
         data = POST_EVENT_DATA
         data['start_date'] = '07/04/2016'
         data['start_time'] = '19:00'
         data['end_date'] = '07/04/2016'
         data['end_time'] = '22:00'
         data['location_name'] = ''
         data['state'] = u'Published'
         data['custom_form[name]'] = ['session_form', 'speaker_form']
         data['custom_form[value]'] = [custom_forms.session_form, custom_forms.speaker_form]
         rv = self.app.post(url, follow_redirects=True, buffered=True, content_type='multipart/form-data',
                            data=data)
         self.assertTrue('To publish your event please review the highlighted fields below' in rv.data, msg=rv.data)
开发者ID:deepakpathania,项目名称:open-event-orga-server,代码行数:18,代码来源:test_events.py

示例9: test_events_edit

# 需要导入模块: from tests.object_mother import ObjectMother [as 别名]
# 或者: from tests.object_mother.ObjectMother import get_custom_form [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
         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]
         rv = self.app.post(url, follow_redirects=True, buffered=True, content_type='multipart/form-data',
                            data=data)
         self.assertTrue(POST_EVENT_DATA['name'] in rv.data, msg=rv.data)
开发者ID:deepakpathania,项目名称:open-event-orga-server,代码行数:19,代码来源:test_events.py

示例10: test_published_event_cfs_view

# 需要导入模块: from tests.object_mother import ObjectMother [as 别名]
# 或者: from tests.object_mother.ObjectMother import get_custom_form [as 别名]
    def test_published_event_cfs_view(self):
        with app.test_request_context():

            event = ObjectMother.get_event()
            event.state = 'Published'
            save_to_db(event, "Event Saved")

            custom_form = ObjectMother.get_custom_form()
            custom_form.event_id = event.id
            save_to_db(custom_form, "Custom form saved")

            call_for_papers = CallForPaper(announcement="Announce",
                                           start_date=datetime(2003, 8, 4, 12, 30, 45),
                                           end_date=datetime(2004, 8, 4, 12, 30, 45),
                                           event_id=event.id)

            save_to_db(call_for_papers, "Call for papers saved")

            rv = self.app.get(url_for('event_detail.display_event_cfs', event_id=event.id), follow_redirects=True)
            self.assertTrue("Closed" in rv.data, msg=rv.data)
开发者ID:agwisniewska,项目名称:open-event-orga-server,代码行数:22,代码来源:test_guest_event_page.py

示例11: test_speaker_edit

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


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