Gracefully handle FileNotFoundError exceptions
This commit is contained in:
@ -52,3 +52,19 @@ def test_wrong_method(client, mocker):
|
||||
headers={"Authorization": "Basic " + valid_credentials})
|
||||
|
||||
assert response.status_code == 405
|
||||
|
||||
|
||||
def test_filenotfound(app, mocker):
|
||||
|
||||
app.config.update({
|
||||
"AUTHFILE": '../tests/nonexistent-users-test.txt'
|
||||
})
|
||||
|
||||
client = app.test_client()
|
||||
|
||||
valid_credentials = base64.b64encode(b"test.example.com:testpassword").decode("utf-8")
|
||||
name = 'nonexistent'
|
||||
response = client.get(f"/flush/{name}",
|
||||
headers={"Authorization": "Basic " + valid_credentials})
|
||||
|
||||
assert response.status_code == 500
|
||||
|
Reference in New Issue
Block a user