def test_session_when_user_is_logged_with_different_roles( self, test_client, session, user, role): user.role = role session.commit() login_as(test_client, user) res = test_client.get('/session') assert res.json['role'] == role
def test_session_when_user_is_logged_with_different_roles( self, test_client, session, user, role): user.roles = [Role.query.filter(Role.name == role).one()] session.commit() login_as(test_client, user) res = test_client.get('/session') assert role in res.json['roles']
def test_delete_filter_from_another_user(self, test_client, session, logged_user): user_filter = SearchFilterFactory.create(creator=logged_user) another_user = UserFactory.create() session.add(user_filter) session.add(another_user) session.commit() logout(test_client, [302]) login_as(test_client, another_user) res = test_client.delete(self.url(user_filter)) assert res.status_code == 404
def test_retrieve_filter_list_is_empty_from_another_user(self, test_client, session, logged_user): user_filter = SearchFilterFactory.create(creator=logged_user) another_user = UserFactory.create() session.add(user_filter) session.add(another_user) session.commit() logout(test_client, [302]) login_as(test_client, another_user) res = test_client.get(self.url()) assert res.status_code == 200 assert res.json == []