Skip to content

Commit

Permalink
Mock token return for unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
NeonDaniel committed Nov 22, 2024
1 parent eb76f47 commit b1d3b03
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tests/test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@ def setUpClass(cls, ws_api, config):
app = create_app(_TEST_CONFIG)
cls.test_app = TestClient(app)

def _get_tokens(self):
@patch("neon_hana.mq_service_api.send_mq_request")
def _get_tokens(self, send_request):
valid_user = User(username="guest", password_hash="password")
send_request.return_value = {"user": valid_user.model_dump(),
"success": True}
if not self.tokens:
response = self.test_app.post("/auth/login",
json={"username": "guest",
Expand Down

0 comments on commit b1d3b03

Please sign in to comment.