diff --git a/src-ui/src/app/components/dashboard/dashboard.component.spec.ts b/src-ui/src/app/components/dashboard/dashboard.component.spec.ts index 3f36b8f0c..23228d247 100644 --- a/src-ui/src/app/components/dashboard/dashboard.component.spec.ts +++ b/src-ui/src/app/components/dashboard/dashboard.component.spec.ts @@ -194,4 +194,14 @@ describe('DashboardComponent', () => { >) expect(toastSpy).toHaveBeenCalled() }) + + it('should get custom app title', () => { + const title = 'FooBar' + expect(component.subtitle).toContain('Paperless-ngx') + expect(component.subtitle).not.toContain(title) + jest.spyOn(settingsService, 'get').mockImplementation((key) => { + if (key === SETTINGS_KEYS.APP_TITLE) return title + }) + expect(component.subtitle).toContain(title) + }) }) diff --git a/src/documents/tests/test_api_app_config.py b/src/documents/tests/test_api_app_config.py index 99512ec77..74f2560df 100644 --- a/src/documents/tests/test_api_app_config.py +++ b/src/documents/tests/test_api_app_config.py @@ -1,4 +1,5 @@ import json +import os from django.contrib.auth.models import User from rest_framework import status @@ -122,3 +123,37 @@ class TestApiAppConfig(DirectoriesMixin, APITestCase): self.assertEqual(response.status_code, status.HTTP_200_OK) config = ApplicationConfiguration.objects.first() self.assertEqual(config.user_args, None) + + def test_api_replace_app_logo(self): + """ + GIVEN: + - Existing config with app_logo specified + WHEN: + - API to replace app_logo is called + THEN: + - old app_logo file is deleted + """ + with open( + os.path.join(os.path.dirname(__file__), "samples", "simple.jpg"), + "rb", + ) as f: + self.client.patch( + f"{self.ENDPOINT}1/", + { + "app_logo": f, + }, + ) + config = ApplicationConfiguration.objects.first() + old_logo = config.app_logo + self.assertTrue(os.path.exists(old_logo.path)) + with open( + os.path.join(os.path.dirname(__file__), "samples", "simple.png"), + "rb", + ) as f: + self.client.patch( + f"{self.ENDPOINT}1/", + { + "app_logo": f, + }, + ) + self.assertFalse(os.path.exists(old_logo.path))