basic python tests

This commit is contained in:
Michael Shamoon 2022-05-09 21:18:30 -07:00
parent d057a5076c
commit 53f905b88b

View File

@ -22,6 +22,7 @@ from documents.models import DocumentType
from documents.models import MatchingModel
from documents.models import SavedView
from documents.models import Tag
from documents.models import UiSettings
from documents.tests.utils import DirectoriesMixin
from paperless import version
from rest_framework.test import APITestCase
@ -1365,6 +1366,27 @@ class TestDocumentApiV2(DirectoriesMixin, APITestCase):
"#000000",
)
def test_ui_settings(self):
test_user = User.objects.create_superuser(username="test")
self.client.force_login(user=test_user)
response = self.client.get(f"/api/ui_settings/", format="json")
self.assertEqual(response.status_code, 200)
self.assertEqual(
response.data["settings"],
[],
)
UiSettings.objects.create(
user=test_user,
settings='{"dark_mode":[{"enabled":"true"}]}',
)
response = self.client.get(f"/api/ui_settings/", format="json")
self.assertNotEqual(
response.data["settings"],
[],
)
class TestBulkEdit(DirectoriesMixin, APITestCase):
def setUp(self):