def test_profile_ok(client): user = UserFactory.create() session = Session( user=user, refresh_token='token_123' ) session.save(force_insert=True) token_data = TokenData( id=user.id, full_name=user.full_name, email=user.email, session_id=session.id ) token = Token.generate_token(token_data=token_data) headers = { 'Authorization': f'Bearer {token}' } response = client.get( '/api/profile', headers=headers ) response_data = response.json['data'] assert response.status_code == 200 assert response_data['id'] == str(user.id) assert response_data['full_name'] == user.full_name assert response_data['email'] == user.email
def test_sign_out_ok(client): user = UserFactory.create() session = Session(user=user, refresh_token='token_123') session.save(force_insert=True) token_data = TokenData(id=user.id, full_name=user.full_name, email=user.email, session_id=session.id) token = Token.generate_token(token_data=token_data) headers = {'Authorization': f'Bearer {token}'} response = client.post('/api/sign-out', headers=headers) assert response.status_code == 204