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


Python ObjectMother.get_user方法代码示例

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


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

示例1: test_role_delete

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

示例2: test_role_create_post

# 需要导入模块: from tests.object_mother import ObjectMother [as 别名]
# 或者: from tests.object_mother.ObjectMother import get_user [as 别名]
    def test_role_create_post(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()
            data = {
                'user_email': user.email,
                'user_role': 'coorganizer'
            }
            rv = self.app.post(url_for('event_roles.create_view', event_id=event.id), follow_redirects=True, data=data)

            # Check if user has been sent a Role Invite
            role = Role.query.filter_by(name='coorganizer').first()
            ri = RoleInvite.query.filter_by(email=user.email, event=event, role=role).first()
            self.assertTrue(ri is not None, msg=rv.data)
开发者ID:hacktrec,项目名称:open-event-orga-server,代码行数:20,代码来源:test_roles.py

示例3: test_role_update

# 需要导入模块: from tests.object_mother import ObjectMother [as 别名]
# 或者: from tests.object_mother.ObjectMother import get_user [as 别名]
 def test_role_update(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")
         data = {
             'user_email': user.email,
             'user_role': 'track_organizer'
         }
         rv = self.app.post(url_for('event_roles.edit_view', uer_id=uer.id, event_id=event.id, data=data),
                            follow_redirects=True)
         uer = DataGetter.get_user_event_roles_by_role_name(event.id, 'track_organizer').first()
         self.assertTrue(uer is not None, msg=rv.data)
开发者ID:hacktrec,项目名称:open-event-orga-server,代码行数:21,代码来源:test_roles.py

示例4: test_my_session_unauthorized_access

# 需要导入模块: from tests.object_mother import ObjectMother [as 别名]
# 或者: from tests.object_mother.ObjectMother import get_user [as 别名]
 def test_my_session_unauthorized_access(self):
     with app.test_request_context():
         event = ObjectMother.get_event()
         user = ObjectMother.get_user()
         save_to_db(user, "User saved")
         save_to_db(event, "Event saved")
         speaker = Speaker(name="name",
                           email="[email protected]",
                           organisation="FOSSASIA",
                           event_id=event.id,
                           user=user,
                           country="India")
         save_to_db(speaker, "Speaker saved")
         session = Session(title='test',
                           long_abstract='dsad',
                           start_time=datetime(2003, 8, 4, 12, 30, 45),
                           end_time=datetime(2003, 8, 4, 12, 30, 45),
                           event_id=event.id,
                           speakers=[speaker],
                           state='pending')
         save_to_db(session, "Session saved")
         rv = self.app.get(url_for('my_sessions.display_session_view', session_id=session.id), follow_redirects=True)
         self.assertEqual(rv.status_code, 404)
开发者ID:deepakpathania,项目名称:open-event-orga-server,代码行数:25,代码来源:test_my_session.py

示例5: test_admin_users

# 需要导入模块: from tests.object_mother import ObjectMother [as 别名]
# 或者: from tests.object_mother.ObjectMother import get_user [as 别名]
 def test_admin_users(self):
     with app.test_request_context():
         user = ObjectMother.get_user()
         save_to_db(user, "User saved")
         rv = self.app.get(url_for('sadmin_users.index_view'), follow_redirects=True)
         self.assertTrue('[email protected]' in rv.data, msg=rv.data)
开发者ID:agwisniewska,项目名称:open-event-orga-server,代码行数:8,代码来源:test_super_admin_views.py


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