Skip to content

Commit

Permalink
tests(agent): use flask_404_description
Browse files Browse the repository at this point in the history
Use variable 404 error description message defined upon the current
version of Flask in agent test.
  • Loading branch information
rezib committed Jan 20, 2025
1 parent 12d7444 commit 986cc7a
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions slurmweb/tests/views/test_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from ..lib.agent import TestAgentBase
from ..lib.utils import (
all_slurm_versions,
flask_404_description,
SlurmwebAssetUnavailable,
)

Expand Down Expand Up @@ -119,14 +120,14 @@ def test_request_slurmrestd_not_found(self, slurm_version):
def test_request_agent_not_found(self):
response = self.client.get("/fail")
self.assertEqual(response.status_code, 404)

self.assertEqual(response.json["code"], 404)
self.assertRegex(
response.json["description"],
r"^The requested URL was not found on the server.\s? If you entered the "
r"URL manually please check your spelling and try again.$",
self.assertEqual(
response.json,
{
"code": 404,
"description": flask_404_description,
"name": "Not Found",
},
)
self.assertEqual(response.json["name"], "Not Found")

def test_access_denied(self):
# Test agent permission denied with @rbac_action decorator by calling /accounts
Expand Down

0 comments on commit 986cc7a

Please sign in to comment.