mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2024-11-05 11:03:12 +00:00
7935de0fe1
Co-authored-by: inexcode <inex.code@selfprivacy.org> Reviewed-on: https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api/pulls/13
41 lines
947 B
Python
41 lines
947 B
Python
# pylint: disable=redefined-outer-name
|
|
# pylint: disable=unused-argument
|
|
import json
|
|
import os
|
|
import pytest
|
|
|
|
from selfprivacy_api.utils import WriteUserData, ReadUserData
|
|
|
|
|
|
def test_get_api_version(authorized_client):
|
|
response = authorized_client.get("/api/version")
|
|
assert response.status_code == 200
|
|
assert "version" in response.json()
|
|
|
|
|
|
def test_get_api_version_unauthorized(client):
|
|
response = client.get("/api/version")
|
|
assert response.status_code == 200
|
|
assert "version" in response.json()
|
|
|
|
|
|
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
|
|
|
|
|
|
@pytest.fixture
|
|
def test_mode():
|
|
return os.environ.get("TEST_MODE")
|
|
|
|
|
|
def test_the_test_mode(test_mode):
|
|
assert test_mode == "true"
|