bdd: Compare HTTP status to a whitelist.
401 (authorization required) is not < 400, and it makes more sense to be strict here anyways.
This commit is contained in:
parent
cda6d7c06d
commit
5856b24d20
@ -24,6 +24,7 @@ import sys
|
|||||||
import json
|
import json
|
||||||
import socket
|
import socket
|
||||||
import os.path
|
import os.path
|
||||||
|
import http.client
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from PyQt5.QtCore import pyqtSignal
|
from PyQt5.QtCore import pyqtSignal
|
||||||
@ -59,9 +60,14 @@ class Request(testprocess.Line):
|
|||||||
missing_paths = ['/favicon.ico', '/does-not-exist']
|
missing_paths = ['/favicon.ico', '/does-not-exist']
|
||||||
|
|
||||||
if self.path in missing_paths:
|
if self.path in missing_paths:
|
||||||
assert self.status == 404
|
assert self.status == http.client.NOT_FOUND # 404
|
||||||
else:
|
else:
|
||||||
assert self.status < 400
|
expected_http_statuses = [
|
||||||
|
http.client.OK, # 200
|
||||||
|
http.client.FOUND, # 302
|
||||||
|
http.client.UNAUTHORIZED # 401
|
||||||
|
]
|
||||||
|
assert self.status in expected_http_statuses
|
||||||
|
|
||||||
def __eq__(self, other):
|
def __eq__(self, other):
|
||||||
return NotImplemented
|
return NotImplemented
|
||||||
|
Loading…
Reference in New Issue
Block a user