Added a new backend settings system

This can be used for saving runtime-configurable settings in the database.
This commit is contained in:
Donkie
2024-01-03 18:44:09 +01:00
parent cad6d4a7f7
commit 44da991d47
11 changed files with 573 additions and 3 deletions

View File

@@ -0,0 +1,44 @@
"""Integration tests for the Vendor API endpoint."""
import httpx
URL = "http://spoolman:8000"
def test_get_currency():
"""Test getting the currency setting."""
# Execute
result = httpx.get(f"{URL}/api/v1/setting/currency")
result.raise_for_status()
# Verify
setting = result.json()
assert setting == {
"value": '"EUR"',
"is_set": False,
"type": "string",
}
def test_get_unknown():
"""Test getting an unknown setting."""
# Execute
result = httpx.get(f"{URL}/api/v1/setting/unknown")
assert result.status_code == 404
def test_get_all():
"""Test getting all settings."""
# Execute
result = httpx.get(f"{URL}/api/v1/setting/")
result.raise_for_status()
# Verify
settings = result.json()
assert settings == {
"currency": {
"value": '"EUR"',
"is_set": False,
"type": "string",
},
}