selfprivacy-rest-api/tests/test_system.py

21 lines
532 B
Python
Raw Normal View History

2021-12-15 09:58:58 +02:00
# pylint: disable=redefined-outer-name
# pylint: disable=unused-argument
import json
import pytest
from selfprivacy_api.utils import get_domain
2021-12-15 11:02:29 +02:00
2021-12-15 09:58:58 +02:00
@pytest.fixture
def domain_file(mocker, datadir):
mocker.patch("selfprivacy_api.utils.DOMAIN_FILE", datadir / "domain")
return datadir
2021-12-15 11:02:29 +02:00
2021-12-15 09:58:58 +02:00
def test_wrong_auth(wrong_auth_client):
response = wrong_auth_client.get("/system/pythonVersion")
assert response.status_code == 401
2021-12-15 11:02:29 +02:00
2021-12-15 09:58:58 +02:00
def test_get_domain(authorized_client, domain_file):
assert get_domain() == "test-domain.tld"