本文整理汇总了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)
示例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)
示例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)
示例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)
示例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)