2022-01-10 20:35:00 +00:00
|
|
|
# pylint: disable=redefined-outer-name
|
|
|
|
# pylint: disable=unused-argument
|
|
|
|
import json
|
|
|
|
import pytest
|
|
|
|
|
2022-01-24 20:01:37 +00:00
|
|
|
from selfprivacy_api.utils import WriteUserData, ReadUserData
|
|
|
|
|
2022-01-10 20:35:00 +00:00
|
|
|
|
|
|
|
def test_get_api_version(authorized_client):
|
|
|
|
response = authorized_client.get("/api/version")
|
|
|
|
assert response.status_code == 200
|
|
|
|
assert "version" in response.get_json()
|
|
|
|
|
|
|
|
|
|
|
|
def test_get_api_version_unauthorized(client):
|
|
|
|
response = client.get("/api/version")
|
|
|
|
assert response.status_code == 200
|
|
|
|
assert "version" in response.get_json()
|
2022-01-17 11:28:17 +00:00
|
|
|
|
2022-01-17 11:29:54 +00:00
|
|
|
|
2022-01-17 11:28:17 +00:00
|
|
|
def test_get_swagger_json(authorized_client):
|
|
|
|
response = authorized_client.get("/api/swagger.json")
|
|
|
|
assert response.status_code == 200
|
|
|
|
assert "swagger" in response.get_json()
|
2022-01-24 20:01:37 +00:00
|
|
|
|
|
|
|
|
|
|
|
def test_read_invalid_user_data():
|
|
|
|
with pytest.raises(ValueError):
|
|
|
|
with ReadUserData("invalid") as user_data:
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
def test_write_invalid_user_data():
|
|
|
|
with pytest.raises(ValueError):
|
|
|
|
with WriteUserData("invalid") as user_data:
|
|
|
|
pass
|