diff --git a/tests/test_testdata.py b/tests/test_testdata.py index cb38bd8..e7e0d23 100644 --- a/tests/test_testdata.py +++ b/tests/test_testdata.py @@ -53,6 +53,17 @@ def _server(request) -> Generator[str, None, None]: break +@pytest.mark.parametrize('_server', [({ + 'keys': ['one', 'two', 'three'], + 'max-size': '100', + 'max-data': 1234, + 'buffer-size': '12MiB', +})], indirect=['_server']) +def test_invalid_api_key(_server): + response = requests.get(f'{PROTOCOL}://{HOST}:{PORT}/zeros?api_key=four&size=100', timeout=TIMEOUT) + assert response.status_code == 401 + + @pytest.mark.parametrize('_server', [({ 'keys': ['one', 'two', 'three'], 'max-size': '100', @@ -85,13 +96,16 @@ def test_request_size_upper_bound(_server): @pytest.mark.parametrize('_server', [({ 'keys': ['one', 'two', 'three'], - 'max-size': '100', - 'max-data': 1234, + 'max-size': '100KB', + 'max-data': '100KB', 'buffer-size': '12MiB', })], indirect=['_server']) -def test_invalid_api_key(_server): - response = requests.get(f'{PROTOCOL}://{HOST}:{PORT}/zeros?api_key=four&size=100', timeout=TIMEOUT) - assert response.status_code == 401 +def test_request_max_data_used(_server): + response = requests.get(f'{PROTOCOL}://{HOST}:{PORT}/zeros?api_key=one&size=100KB', timeout=TIMEOUT) + assert response.status_code == 200 + + response = requests.get(f'{PROTOCOL}://{HOST}:{PORT}/zeros?api_key=one&size=1', timeout=TIMEOUT) + assert response.status_code == 500 @pytest.mark.parametrize('_server', [({