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

Python setup_database.Setup类代码示例

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

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



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

示例1: setUp

 def setUp(self):
     self.app = Setup.create_app()
     with app.test_request_context():
         # `event_id` is going to be 1
         event_id = create_event()
         # Associate services to event_id
         create_services(event_id)
开发者ID:deepakpathania,项目名称:open-event-orga-server,代码行数:7,代码来源:test_get_api_200.py


示例2: setUp

    def setUp(self):
        self.app = Setup.create_app()
        with app.test_request_context():
            event = Event(name=UNICODE_STRING,
                          start_time=datetime(2013, 8, 4, 12, 30, 45),
                          end_time=datetime(2016, 9, 4, 12, 30, 45))
            event.owner = 1

            microlocation = Microlocation(name=UNICODE_STRING)
            level = Level(name=UNICODE_STRING, event_id=1)
            session_format = Format(name=UNICODE_STRING, label_en='label',
                                    event_id=1)
            language = Language(name=UNICODE_STRING, event_id=1)
            session = Session(title=UNICODE_STRING, description='descp',
                              start_time=datetime(2014, 8, 4, 12, 30, 45),
                              end_time=datetime(2015, 9, 4, 12, 30, 45))
            speaker = Speaker(name=UNICODE_STRING, email='[email protected]',
                              organisation='org', country='japan')
            sponsor = Sponsor(name=UNICODE_STRING)

            save_to_db(event, "Event saved")
            save_to_db(microlocation, 'Microlocation saved')
            save_to_db(level, 'Level saved')
            save_to_db(session_format, 'Format saved')
            save_to_db(language, 'Language saved')
            save_to_db(session, 'Session saved')
            save_to_db(speaker, 'Speaker saved')
            save_to_db(sponsor, 'Sponsor saved')
开发者ID:aditya1702,项目名称:open-event-orga-server,代码行数:28,代码来源:test_model_unicode.py


示例3: setUp

 def setUp(self):
     self.app = Setup.create_app()
     with app.test_request_context():
         register(self.app, u'[email protected]', u'test')
         update_role_to_admin({'admin_perm': 'isAdmin'}, user_id=1)
         event_id = create_event(creator_email='[email protected]')
         create_services(event_id)
开发者ID:hacktrec,项目名称:open-event-orga-server,代码行数:7,代码来源:test_trashed_items.py


示例4: setUp

 def setUp(self):
     self.app = Setup.create_app()
     with app.test_request_context():
         register(self.app, u'[email protected]', u'test')
         logout(self.app)
         event_id = create_event(
             name='TestEvent_1', creator_email=u'[email protected]')
         create_services(event_id)
开发者ID:hacktrec,项目名称:open-event-orga-server,代码行数:8,代码来源:test_put_api.py


示例5: setUp

 def setUp(self):
     self.app = Setup.create_app()
     with app.test_request_context():
         register(self.app, u'[email protected]', u'test')
         # `event_id` is going to be 1
         event_id = create_event(creator_email=u'[email protected]')
         # Associate services to event_id
         create_services(event_id)
开发者ID:hacktrec,项目名称:open-event-orga-server,代码行数:8,代码来源:test_get_api_200.py


示例6: setUp

 def setUp(self):
     """Create Event but don't define services for it.
     """
     self.app = Setup.create_app()
     with app.test_request_context():
         register(self.app, u'[email protected]', u'test')
         # Created event will have id=1
         create_event(creator_email=u'[email protected]')
开发者ID:hacktrec,项目名称:open-event-orga-server,代码行数:8,代码来源:test_get_api_404.py


示例7: setUp

 def setUp(self):
     self.app = Setup.create_app()
     with app.test_request_context():
         register(self.app, u'[email protected]', u'test')
         create_event(creator_email='[email protected]')
         create_services(1, '1')
         create_services(1, '2')
         create_services(1, '3')
开发者ID:faheemzunjani,项目名称:open-event-orga-server,代码行数:8,代码来源:test_export_import.py


示例8: setUp

 def setUp(self):
     """Create Event (it will have id = `event_id`). Create services and
     associate them with event id = `event_id` + 1.
     """
     self.app = Setup.create_app()
     with app.test_request_context():
         # `event_id` is going to be 1
         event_id = create_event()
         # Associate services to event_id=2
         # No need to create the event though
         create_services(event_id+1)
开发者ID:agwisniewska,项目名称:open-event-orga-server,代码行数:11,代码来源:test_get_api_400.py


示例9: setUp

    def setUp(self):
        self.app = Setup.create_app()
        with app.test_request_context():
            event = Event(name="event1",
                          start_time=datetime(2013, 8, 4, 12, 30, 45),
                          end_time=datetime(2016, 9, 4, 12, 30, 45))
            event.owner = 1
            save_to_db(event, "Event saved")

            self.event_form = EventForm()
            self.session_form = SessionForm()
开发者ID:aditya1702,项目名称:open-event-orga-server,代码行数:11,代码来源:test_validations.py


示例10: test_event_api

 def test_event_api(self):
     self.app = Setup.create_app()
     with app.test_request_context():
         register(self.app, u'[email protected]', u'test')
         login(self.app, u'[email protected]', u'test')
         # Non existing event
         event_id = 1
         path = get_path(event_id)
         response = self.app.get(path)
         self.assertEqual(response.status_code, 404)
         self.assertIn('does not exist', response.data)
开发者ID:hacktrec,项目名称:open-event-orga-server,代码行数:11,代码来源:test_get_api_404.py


示例11: test_add_social_link_to_db

 def test_add_social_link_to_db(self):
     """Checks the one to many relationship between event and social_links """
     self.app = Setup.create_app()
     with app.test_request_context():
         event = ObjectMother.get_event()
         social_link1 = SocialLink(name='Link1', link='some_random_link_1', event_id='1')
         social_link2 = SocialLink(name='Link2', link='some_random_link_2', event_id='1')
         save_to_db(event, "Event Saved")
         save_to_db(social_link1, "SocialLink1 Saved")
         save_to_db(social_link2, "SocialLink2 Saved")
         self.assertEqual(social_link1.event_id, 1)
         self.assertEqual(social_link2.event_id, 1)
开发者ID:hacktrec,项目名称:open-event-orga-server,代码行数:12,代码来源:test_social_link.py


示例12: setUp

 def setUp(self):
     """Create Event (it will have id = `event_id`). Create services and
     associate them with event id = `event_id` + 1.
     """
     self.app = Setup.create_app()
     with app.test_request_context():
         register(self.app, u'[email protected]', u'test')
         # `event_id` is going to be 1
         event_id = create_event(creator_email=u'[email protected]')
         # Associate services to event_id=2
         # No need to create the event though
         create_services(event_id+1)
开发者ID:hacktrec,项目名称:open-event-orga-server,代码行数:12,代码来源:test_get_api_400.py


示例13: setUp

    def setUp(self):
        self.app = Setup.create_app()
        with app.test_request_context():
            # Create two instances of event/services

            # event_id is going to be 1
            event_id1 = create_event('TestEvent_1')
            # event_id is going to be 2
            create_event('TestEvent_2')

            # Associate services to event_id1
            create_services(event_id1, serial_no=1)
            create_services(event_id1, serial_no=2)
开发者ID:faheemzunjani,项目名称:open-event-orga-server,代码行数:13,代码来源:test_get_api_listed_200.py


示例14: setUp

    def setUp(self):
        self.app = Setup.create_app()
        with app.test_request_context():
            register(self.app, u'[email protected]', u'test')
            # User must be part of the staff to access listed events
            update_role_to_admin({'admin_perm': 'isAdmin'}, user_id=1)
            # Create two instances of event/services

            # event_id is going to be 1
            event_id1 = create_event('TestEvent_1', creator_email=u'[email protected]')
            # event_id is going to be 2
            create_event('TestEvent_2', creator_email=u'[email protected]')

            # Associate services to event_id1
            create_services(event_id1, serial_no=1)
            create_services(event_id1, serial_no=2)
开发者ID:hacktrec,项目名称:open-event-orga-server,代码行数:16,代码来源:test_get_api_listed_200.py


示例15: setUp

    def setUp(self):
        self.app = Setup.create_app()
        with app.test_request_context():
            event = Event(name=UNICODE_STRING,
                          start_time=datetime(2013, 8, 4, 12, 30, 45),
                          end_time=datetime(2016, 9, 4, 12, 30, 45))
            event.owner = 1

            microlocation = Microlocation(name=UNICODE_STRING)
            session = Session(title=UNICODE_STRING, long_abstract='descp',
                              start_time=datetime(2014, 8, 4, 12, 30, 45),
                              end_time=datetime(2015, 9, 4, 12, 30, 45))
            speaker = Speaker(name=UNICODE_STRING, email='[email protected]',
                              organisation='org', country='japan')
            sponsor = Sponsor(name=UNICODE_STRING)

            save_to_db(event, "Event saved")
            save_to_db(microlocation, 'Microlocation saved')
            save_to_db(session, 'Session saved')
            save_to_db(speaker, 'Speaker saved')
            save_to_db(sponsor, 'Sponsor saved')
开发者ID:agwisniewska,项目名称:open-event-orga-server,代码行数:21,代码来源:test_model_unicode.py


示例16: test_add_session_type_to_db

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


示例17: setUp

 def setUp(self):
     self.app = Setup.create_app()
开发者ID:hacktrec,项目名称:open-event-orga-server,代码行数:2,代码来源:test_admin_trash.py


示例18: setUp

 def setUp(self):
     self.app = Setup.create_app()
     with app.test_request_context():
         register(self.app, u'[email protected]', u'test')
         create_event(name='TestEvent0', creator_email='[email protected]')
开发者ID:agwisniewska,项目名称:open-event-orga-server,代码行数:5,代码来源:test_custom_forms.py


示例19: setUp

 def setUp(self):
     self.app = Setup.create_app()
     with app.test_request_context():
         create_user('[email protected]', 'test')
         create_user('[email protected]', 'test')
开发者ID:agwisniewska,项目名称:open-event-orga-server,代码行数:5,代码来源:test_user_api.py


示例20: setUp

 def setUp(self):
     self.app = Setup.create_app()
     with app.test_request_context():
         register(self.app, u'[email protected]', u'test')
         create_event(creator_email=u'[email protected]')
开发者ID:hacktrec,项目名称:open-event-orga-server,代码行数:5,代码来源:test_post_api_auth.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python shared.getEmptyCol函数代码示例发布时间:2022-05-27
下一篇:
Python setup_cluster.kill_mongo_proc函数代码示例发布时间: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