From 53f905b88bf995c584db817894620d3cac8303af Mon Sep 17 00:00:00 2001 From: Michael Shamoon <4887959+shamoon@users.noreply.github.com> Date: Mon, 9 May 2022 21:18:30 -0700 Subject: [PATCH] basic python tests --- src/documents/tests/test_api.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/documents/tests/test_api.py b/src/documents/tests/test_api.py index b492181d8..1b88e6a3d 100644 --- a/src/documents/tests/test_api.py +++ b/src/documents/tests/test_api.py @@ -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):