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

Python setup_database.Setup类代码示例

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

本文整理汇总了Python中tests.unittests.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():
         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:ashishpahwa7,项目名称:open-event-orga-server,代码行数:7,代码来源:test_trashed_items.py


示例2: 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:ashishpahwa7,项目名称:open-event-orga-server,代码行数:8,代码来源:test_put_api.py


示例3: 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:ashishpahwa7,项目名称:open-event-orga-server,代码行数:8,代码来源:test_get_api_404.py


示例4: 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:ashishpahwa7,项目名称:open-event-orga-server,代码行数:8,代码来源:test_get_api_200.py


示例5: 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:SaptakS,项目名称:open-event-orga-server,代码行数:8,代码来源:test_export_import.py


示例6: setUp

 def setUp(self):
     self.app = Setup.create_app()
     app.config['TESTING'] = True
     app.secret_key = 'super secret key'
     app.config['PROFILE'] = True
     app.wsgi_app = ProfilerMiddleware(app.wsgi_app, restrictions=[30])
     with app.test_request_context():
         db.create_all()
         populate()
开发者ID:ashishpahwa7,项目名称:open-event-orga-server,代码行数:9,代码来源:test_db_performance.py


示例7: 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)

            event_id = create_event(creator_email=u'[email protected]')
            create_services(event_id)
开发者ID:ashishpahwa7,项目名称:open-event-orga-server,代码行数:9,代码来源:test_get_api_paginated.py


示例8: 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]', location_name='Science Centre, Singapore',
             latitude=87.5, longitude=88.5
         )
         create_services(1, '1')
         create_session(1, '2', state='accepted', track=1, microlocation=1, speakers=[1], session_type=1)
开发者ID:codebhendi,项目名称:open-event-orga-server,代码行数:10,代码来源:test_export_import_more.py


示例9: 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:ashishpahwa7,项目名称:open-event-orga-server,代码行数:11,代码来源:test_get_api_404.py


示例10: 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:ashishpahwa7,项目名称:open-event-orga-server,代码行数:12,代码来源:test_get_api_400.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:SaptakS,项目名称:open-event-orga-server,代码行数:12,代码来源:test_social_link.py


示例12: 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:SaptakS,项目名称:open-event-orga-server,代码行数:16,代码来源:test_get_api_listed_200.py


示例13: 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:ashishpahwa7,项目名称:open-event-orga-server,代码行数:21,代码来源:test_model_unicode.py


示例14: 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 many 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()
         session_type1 = SessionType(name='Type1', length='30', event_id='1')
         session_type2 = SessionType(name='Type2', length='30', event_id='1')
         session2 = Session(title='test2',
                            long_abstract='dsadsd',
                            start_time=datetime(2003, 8, 4, 12, 30, 45),
                            end_time=datetime(2003, 8, 4, 12, 30, 45),
                            session_type=session_type1)
         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(session2.session_type_id, 1)
         self.assertEqual(session1.session_type_id, None)
开发者ID:SaptakS,项目名称:open-event-orga-server,代码行数:23,代码来源:test_session_type.py


示例15: 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]')
         logout(self.app)
开发者ID:ashishpahwa7,项目名称:open-event-orga-server,代码行数:6,代码来源:test_post_api_auth.py


示例16: setUp

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


示例17: setUp

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


示例18: setUp

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


示例19: setUp

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


示例20: tearDown

 def tearDown(self):
     Setup.drop_db()
开发者ID:eddygta17,项目名称:open-event-server,代码行数:2,代码来源:utils.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python url_util.url函数代码示例发布时间:2022-05-27
下一篇:
Python object_mother.ObjectMother类代码示例发布时间: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