Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

brands: migrate custom CSS to brands #13172

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

brands: migrate custom CSS to brands #13172

wants to merge 1 commit into from

Conversation

BeryJu
Copy link
Member

@BeryJu BeryJu commented Feb 22, 2025

Details

As part of the root-dir move in the container, we might as well remove the requirement on a static file by migrating it to a brand field instead


Checklist

  • Local tests pass (ak test authentik/)
  • The code has been formatted (make lint-fix)

If an API change has been made

  • The API schema has been updated (make gen-build)

If changes to the frontend have been made

  • The code has been formatted (make web)

If applicable

  • The documentation has been updated
  • The documentation has been formatted (make website)

@BeryJu BeryJu requested review from a team as code owners February 22, 2025 01:55
Copy link

netlify bot commented Feb 22, 2025

Deploy Preview for authentik-docs canceled.

Name Link
🔨 Latest commit dd8e687
🔍 Latest deploy log https://app.netlify.com/sites/authentik-docs/deploys/67b92eace81ee90008dc73ef

Copy link

netlify bot commented Feb 22, 2025

Deploy Preview for authentik-storybook ready!

Name Link
🔨 Latest commit dd8e687
🔍 Latest deploy log https://app.netlify.com/sites/authentik-storybook/deploys/67b92eac0038e30008b11036
😎 Deploy Preview https://deploy-preview-13172--authentik-storybook.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

codecov bot commented Feb 22, 2025

❌ 4 Tests Failed:

Tests completed Failed Passed Skipped
1712 4 1708 2
View the top 3 failed test(s) by shortest run time
authentik.brands.tests.TestBrands::test_brand_subdomain
Stack Traces | 0.046s run time
self = <unittest.case._Outcome object at 0x7fb87d946840>
test_case = <authentik.brands.tests.TestBrands testMethod=test_brand_subdomain>
subTest = False

    @contextlib.contextmanager
    def testPartExecutor(self, test_case, subTest=False):
        old_success = self.success
        self.success = True
        try:
>           yield

.../hostedtoolcache/Python/3.12.9................../x64/lib/python3.12/unittest/case.py:58: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <authentik.brands.tests.TestBrands testMethod=test_brand_subdomain>
result = <TestCaseFunction test_brand_subdomain>

    def run(self, result=None):
        if result is None:
            result = self.defaultTestResult()
            startTestRun = getattr(result, 'startTestRun', None)
            stopTestRun = getattr(result, 'stopTestRun', None)
            if startTestRun is not None:
                startTestRun()
        else:
            stopTestRun = None
    
        result.startTest(self)
        try:
            testMethod = getattr(self, self._testMethodName)
            if (getattr(self.__class__, "__unittest_skip__", False) or
                getattr(testMethod, "__unittest_skip__", False)):
                # If the class or method was skipped.
                skip_why = (getattr(self.__class__, '__unittest_skip_why__', '')
                            or getattr(testMethod, '__unittest_skip_why__', ''))
                _addSkip(result, self, skip_why)
                return result
    
            expecting_failure = (
                getattr(self, "__unittest_expecting_failure__", False) or
                getattr(testMethod, "__unittest_expecting_failure__", False)
            )
            outcome = _Outcome(result)
            start_time = time.perf_counter()
            try:
                self._outcome = outcome
    
                with outcome.testPartExecutor(self):
                    self._callSetUp()
                if outcome.success:
                    outcome.expecting_failure = expecting_failure
                    with outcome.testPartExecutor(self):
>                       self._callTestMethod(testMethod)

.../hostedtoolcache/Python/3.12.9................../x64/lib/python3.12/unittest/case.py:634: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <authentik.brands.tests.TestBrands testMethod=test_brand_subdomain>
method = <bound method TestBrands.test_brand_subdomain of <authentik.brands.tests.TestBrands testMethod=test_brand_subdomain>>

    def _callTestMethod(self, method):
>       if method() is not None:

.../hostedtoolcache/Python/3.12.9................../x64/lib/python3.12/unittest/case.py:589: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <authentik.brands.tests.TestBrands testMethod=test_brand_subdomain>

    def test_brand_subdomain(self):
        """Test Current brand API"""
        Brand.objects.all().delete()
        Brand.objects.create(domain="bar.baz", branding_title="custom")
>       self.assertJSONEqual(
            self.client.get(
                reverse("authentik_api:brand-current"), HTTP_HOST="foo.bar.baz"
            ).content.decode(),
            {
                "branding_logo": ".../assets/icons/icon_left_brand.svg",
                "branding_favicon": ".../assets/icons/icon.png",
                "branding_title": "custom",
                "matched_domain": "bar.baz",
                "ui_footer_links": [],
                "ui_theme": Themes.AUTOMATIC,
                "default_locale": "",
            },
        )

authentik/brands/tests.py:38: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <authentik.brands.tests.TestBrands testMethod=test_brand_subdomain>
raw = '{"matched_domain":"bar.baz","branding_title":"custom","branding_logo":".../assets/icons/icon_left_brand.svg"....../assets/icons/icon.png","branding_custom_css":"","ui_footer_links":[],"ui_theme":"automatic","default_locale":""}'
expected_data = {'branding_favicon': '.../assets/icons/icon.png', 'branding_logo': '.../assets/icons/icon_left_brand.svg', 'branding_title': 'custom', 'default_locale': '', ...}
msg = None

    def assertJSONEqual(self, raw, expected_data, msg=None):
        """
        Assert that the JSON fragments raw and expected_data are equal.
        Usual JSON non-significant whitespace rules apply as the heavyweight
        is delegated to the json library.
        """
        try:
            data = json.loads(raw)
        except json.JSONDecodeError:
            self.fail("First argument is not valid JSON: %r" % raw)
        if isinstance(expected_data, str):
            try:
                expected_data = json.loads(expected_data)
            except ValueError:
                self.fail("Second argument is not valid JSON: %r" % expected_data)
>       self.assertEqual(data, expected_data, msg=msg)

../../../..../pypoetry/virtualenvs/authentik-xvtLQ9eE-py3.12/lib/python3.12.../django/test/testcases.py:922: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <authentik.brands.tests.TestBrands testMethod=test_brand_subdomain>
first = {'branding_custom_css': '', 'branding_favicon': '.../assets/icons/icon.png', 'branding_logo': '.../assets/icons/icon_left_brand.svg', 'branding_title': 'custom', ...}
second = {'branding_favicon': '.../assets/icons/icon.png', 'branding_logo': '.../assets/icons/icon_left_brand.svg', 'branding_title': 'custom', 'default_locale': '', ...}
msg = None

    def assertEqual(self, first, second, msg=None):
        """Fail if the two objects are unequal as determined by the '=='
           operator.
        """
        assertion_func = self._getAssertEqualityFunc(first, second)
>       assertion_func(first, second, msg=msg)

.../hostedtoolcache/Python/3.12.9................../x64/lib/python3.12/unittest/case.py:885: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <authentik.brands.tests.TestBrands testMethod=test_brand_subdomain>
d1 = {'branding_custom_css': '', 'branding_favicon': '.../assets/icons/icon.png', 'branding_logo': '.../assets/icons/icon_left_brand.svg', 'branding_title': 'custom', ...}
d2 = {'branding_favicon': '.../assets/icons/icon.png', 'branding_logo': '.../assets/icons/icon_left_brand.svg', 'branding_title': 'custom', 'default_locale': '', ...}
msg = None

    def assertDictEqual(self, d1, d2, msg=None):
        self.assertIsInstance(d1, dict, 'First argument is not a dictionary')
        self.assertIsInstance(d2, dict, 'Second argument is not a dictionary')
    
        if d1 != d2:
            standardMsg = '%s != %s' % _common_shorten_repr(d1, d2)
            diff = ('\n' + '\n'.join(difflib.ndiff(
                           pprint.pformat(d1).splitlines(),
                           pprint.pformat(d2).splitlines())))
            standardMsg = self._truncateMessage(standardMsg, diff)
>           self.fail(self._formatMessage(msg, standardMsg))

.../hostedtoolcache/Python/3.12.9................../x64/lib/python3.12/unittest/case.py:1184: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <authentik.brands.tests.TestBrands testMethod=test_brand_subdomain>
msg = "{'matched_domain': 'bar.baz', 'branding_tit[230 chars]: ''} != {'branding_logo': '.../dist/assets/icon[208 chars]...'matched_domain': 'bar.baz',\n   'ui_footer_links': [],\n-  'ui_theme': 'automatic'}\n+  'ui_theme': Themes.AUTOMATIC}"

    def fail(self, msg=None):
        """Fail immediately, with the given message."""
>       raise self.failureException(msg)
E       AssertionError: {'matched_domain': 'bar.baz', 'branding_tit[230 chars]: ''} != {'branding_logo': '.../dist/assets/icon[208 chars]: ''}
E       - {'branding_custom_css': '',
E       -  'branding_favicon': '.../assets/icons/icon.png',
E       ? ^
E       
E       + {'branding_favicon': '.../assets/icons/icon.png',
E       ? ^
E       
E          'branding_logo': '.../assets/icons/icon_left_brand.svg',
E          'branding_title': 'custom',
E          'default_locale': '',
E          'matched_domain': 'bar.baz',
E          'ui_footer_links': [],
E       -  'ui_theme': 'automatic'}
E       +  'ui_theme': Themes.AUTOMATIC}

.../hostedtoolcache/Python/3.12.9................../x64/lib/python3.12/unittest/case.py:715: AssertionError
authentik.brands.tests.TestBrands::test_current_brand
Stack Traces | 0.051s run time
self = <unittest.case._Outcome object at 0x7fb8812bee70>
test_case = <authentik.brands.tests.TestBrands testMethod=test_current_brand>
subTest = False

    @contextlib.contextmanager
    def testPartExecutor(self, test_case, subTest=False):
        old_success = self.success
        self.success = True
        try:
>           yield

.../hostedtoolcache/Python/3.12.9................../x64/lib/python3.12/unittest/case.py:58: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <authentik.brands.tests.TestBrands testMethod=test_current_brand>
result = <TestCaseFunction test_current_brand>

    def run(self, result=None):
        if result is None:
            result = self.defaultTestResult()
            startTestRun = getattr(result, 'startTestRun', None)
            stopTestRun = getattr(result, 'stopTestRun', None)
            if startTestRun is not None:
                startTestRun()
        else:
            stopTestRun = None
    
        result.startTest(self)
        try:
            testMethod = getattr(self, self._testMethodName)
            if (getattr(self.__class__, "__unittest_skip__", False) or
                getattr(testMethod, "__unittest_skip__", False)):
                # If the class or method was skipped.
                skip_why = (getattr(self.__class__, '__unittest_skip_why__', '')
                            or getattr(testMethod, '__unittest_skip_why__', ''))
                _addSkip(result, self, skip_why)
                return result
    
            expecting_failure = (
                getattr(self, "__unittest_expecting_failure__", False) or
                getattr(testMethod, "__unittest_expecting_failure__", False)
            )
            outcome = _Outcome(result)
            start_time = time.perf_counter()
            try:
                self._outcome = outcome
    
                with outcome.testPartExecutor(self):
                    self._callSetUp()
                if outcome.success:
                    outcome.expecting_failure = expecting_failure
                    with outcome.testPartExecutor(self):
>                       self._callTestMethod(testMethod)

.../hostedtoolcache/Python/3.12.9................../x64/lib/python3.12/unittest/case.py:634: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <authentik.brands.tests.TestBrands testMethod=test_current_brand>
method = <bound method TestBrands.test_current_brand of <authentik.brands.tests.TestBrands testMethod=test_current_brand>>

    def _callTestMethod(self, method):
>       if method() is not None:

.../hostedtoolcache/Python/3.12.9................../x64/lib/python3.12/unittest/case.py:589: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <authentik.brands.tests.TestBrands testMethod=test_current_brand>

    def test_current_brand(self):
        """Test Current brand API"""
        brand = create_test_brand()
>       self.assertJSONEqual(
            self.client.get(reverse("authentik_api:brand-current")).content.decode(),
            {
                "branding_logo": ".../assets/icons/icon_left_brand.svg",
                "branding_favicon": ".../assets/icons/icon.png",
                "branding_title": "authentik",
                "matched_domain": brand.domain,
                "ui_footer_links": [],
                "ui_theme": Themes.AUTOMATIC,
                "default_locale": "",
            },
        )

authentik/brands/tests.py:21: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <authentik.brands.tests.TestBrands testMethod=test_current_brand>
raw = '{"matched_domain":"0W6KxnMHgQNfNWJiWIdq","branding_title":"authentik","branding_logo":".../assets/icons/icon....../assets/icons/icon.png","branding_custom_css":"","ui_footer_links":[],"ui_theme":"automatic","default_locale":""}'
expected_data = {'branding_favicon': '.../assets/icons/icon.png', 'branding_logo': '.../assets/icons/icon_left_brand.svg', 'branding_title': 'authentik', 'default_locale': '', ...}
msg = None

    def assertJSONEqual(self, raw, expected_data, msg=None):
        """
        Assert that the JSON fragments raw and expected_data are equal.
        Usual JSON non-significant whitespace rules apply as the heavyweight
        is delegated to the json library.
        """
        try:
            data = json.loads(raw)
        except json.JSONDecodeError:
            self.fail("First argument is not valid JSON: %r" % raw)
        if isinstance(expected_data, str):
            try:
                expected_data = json.loads(expected_data)
            except ValueError:
                self.fail("Second argument is not valid JSON: %r" % expected_data)
>       self.assertEqual(data, expected_data, msg=msg)

../../../..../pypoetry/virtualenvs/authentik-xvtLQ9eE-py3.12/lib/python3.12.../django/test/testcases.py:922: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <authentik.brands.tests.TestBrands testMethod=test_current_brand>
first = {'branding_custom_css': '', 'branding_favicon': '.../assets/icons/icon.png', 'branding_logo': '.../assets/icons/icon_left_brand.svg', 'branding_title': 'authentik', ...}
second = {'branding_favicon': '.../assets/icons/icon.png', 'branding_logo': '.../assets/icons/icon_left_brand.svg', 'branding_title': 'authentik', 'default_locale': '', ...}
msg = None

    def assertEqual(self, first, second, msg=None):
        """Fail if the two objects are unequal as determined by the '=='
           operator.
        """
        assertion_func = self._getAssertEqualityFunc(first, second)
>       assertion_func(first, second, msg=msg)

.../hostedtoolcache/Python/3.12.9................../x64/lib/python3.12/unittest/case.py:885: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <authentik.brands.tests.TestBrands testMethod=test_current_brand>
d1 = {'branding_custom_css': '', 'branding_favicon': '.../assets/icons/icon.png', 'branding_logo': '.../assets/icons/icon_left_brand.svg', 'branding_title': 'authentik', ...}
d2 = {'branding_favicon': '.../assets/icons/icon.png', 'branding_logo': '.../assets/icons/icon_left_brand.svg', 'branding_title': 'authentik', 'default_locale': '', ...}
msg = None

    def assertDictEqual(self, d1, d2, msg=None):
        self.assertIsInstance(d1, dict, 'First argument is not a dictionary')
        self.assertIsInstance(d2, dict, 'Second argument is not a dictionary')
    
        if d1 != d2:
            standardMsg = '%s != %s' % _common_shorten_repr(d1, d2)
            diff = ('\n' + '\n'.join(difflib.ndiff(
                           pprint.pformat(d1).splitlines(),
                           pprint.pformat(d2).splitlines())))
            standardMsg = self._truncateMessage(standardMsg, diff)
>           self.fail(self._formatMessage(msg, standardMsg))

.../hostedtoolcache/Python/3.12.9................../x64/lib/python3.12/unittest/case.py:1184: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <authentik.brands.tests.TestBrands testMethod=test_current_brand>
msg = "{'matched_domain': '0W6KxnMHgQNfNWJiWIdq', [246 chars]: ''} != {'branding_logo': '.../dist/assets/icon[224 chars]...in': '0W6KxnMHgQNfNWJiWIdq',\n   'ui_footer_links': [],\n-  'ui_theme': 'automatic'}\n+  'ui_theme': Themes.AUTOMATIC}"

    def fail(self, msg=None):
        """Fail immediately, with the given message."""
>       raise self.failureException(msg)
E       AssertionError: {'matched_domain': '0W6KxnMHgQNfNWJiWIdq', [246 chars]: ''} != {'branding_logo': '.../dist/assets/icon[224 chars]: ''}
E       - {'branding_custom_css': '',
E       -  'branding_favicon': '.../assets/icons/icon.png',
E       ? ^
E       
E       + {'branding_favicon': '.../assets/icons/icon.png',
E       ? ^
E       
E          'branding_logo': '.../assets/icons/icon_left_brand.svg',
E          'branding_title': 'authentik',
E          'default_locale': '',
E          'matched_domain': '0W6KxnMHgQNfNWJiWIdq',
E          'ui_footer_links': [],
E       -  'ui_theme': 'automatic'}
E       +  'ui_theme': Themes.AUTOMATIC}

.../hostedtoolcache/Python/3.12.9................../x64/lib/python3.12/unittest/case.py:715: AssertionError
authentik.brands.tests.TestBrands::test_fallback
Stack Traces | 0.065s run time
self = <unittest.case._Outcome object at 0x7fb87d99c9e0>
test_case = <authentik.brands.tests.TestBrands testMethod=test_fallback>
subTest = False

    @contextlib.contextmanager
    def testPartExecutor(self, test_case, subTest=False):
        old_success = self.success
        self.success = True
        try:
>           yield

.../hostedtoolcache/Python/3.12.9................../x64/lib/python3.12/unittest/case.py:58: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <authentik.brands.tests.TestBrands testMethod=test_fallback>
result = <TestCaseFunction test_fallback>

    def run(self, result=None):
        if result is None:
            result = self.defaultTestResult()
            startTestRun = getattr(result, 'startTestRun', None)
            stopTestRun = getattr(result, 'stopTestRun', None)
            if startTestRun is not None:
                startTestRun()
        else:
            stopTestRun = None
    
        result.startTest(self)
        try:
            testMethod = getattr(self, self._testMethodName)
            if (getattr(self.__class__, "__unittest_skip__", False) or
                getattr(testMethod, "__unittest_skip__", False)):
                # If the class or method was skipped.
                skip_why = (getattr(self.__class__, '__unittest_skip_why__', '')
                            or getattr(testMethod, '__unittest_skip_why__', ''))
                _addSkip(result, self, skip_why)
                return result
    
            expecting_failure = (
                getattr(self, "__unittest_expecting_failure__", False) or
                getattr(testMethod, "__unittest_expecting_failure__", False)
            )
            outcome = _Outcome(result)
            start_time = time.perf_counter()
            try:
                self._outcome = outcome
    
                with outcome.testPartExecutor(self):
                    self._callSetUp()
                if outcome.success:
                    outcome.expecting_failure = expecting_failure
                    with outcome.testPartExecutor(self):
>                       self._callTestMethod(testMethod)

.../hostedtoolcache/Python/3.12.9................../x64/lib/python3.12/unittest/case.py:634: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <authentik.brands.tests.TestBrands testMethod=test_fallback>
method = <bound method TestBrands.test_fallback of <authentik.brands.tests.TestBrands testMethod=test_fallback>>

    def _callTestMethod(self, method):
>       if method() is not None:

.../hostedtoolcache/Python/3.12.9................../x64/lib/python3.12/unittest/case.py:589: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <authentik.brands.tests.TestBrands testMethod=test_fallback>

    def test_fallback(self):
        """Test fallback brand"""
        Brand.objects.all().delete()
>       self.assertJSONEqual(
            self.client.get(reverse("authentik_api:brand-current")).content.decode(),
            {
                "branding_logo": ".../assets/icons/icon_left_brand.svg",
                "branding_favicon": ".../assets/icons/icon.png",
                "branding_title": "authentik",
                "matched_domain": "fallback",
                "ui_footer_links": [],
                "ui_theme": Themes.AUTOMATIC,
                "default_locale": "",
            },
        )

authentik/brands/tests.py:56: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <authentik.brands.tests.TestBrands testMethod=test_fallback>
raw = '{"matched_domain":"fallback","branding_title":"authentik","branding_logo":".../assets/icons/icon_left_brand......./assets/icons/icon.png","branding_custom_css":"","ui_footer_links":[],"ui_theme":"automatic","default_locale":""}'
expected_data = {'branding_favicon': '.../assets/icons/icon.png', 'branding_logo': '.../assets/icons/icon_left_brand.svg', 'branding_title': 'authentik', 'default_locale': '', ...}
msg = None

    def assertJSONEqual(self, raw, expected_data, msg=None):
        """
        Assert that the JSON fragments raw and expected_data are equal.
        Usual JSON non-significant whitespace rules apply as the heavyweight
        is delegated to the json library.
        """
        try:
            data = json.loads(raw)
        except json.JSONDecodeError:
            self.fail("First argument is not valid JSON: %r" % raw)
        if isinstance(expected_data, str):
            try:
                expected_data = json.loads(expected_data)
            except ValueError:
                self.fail("Second argument is not valid JSON: %r" % expected_data)
>       self.assertEqual(data, expected_data, msg=msg)

../../../..../pypoetry/virtualenvs/authentik-xvtLQ9eE-py3.12/lib/python3.12.../django/test/testcases.py:922: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <authentik.brands.tests.TestBrands testMethod=test_fallback>
first = {'branding_custom_css': '', 'branding_favicon': '.../assets/icons/icon.png', 'branding_logo': '.../assets/icons/icon_left_brand.svg', 'branding_title': 'authentik', ...}
second = {'branding_favicon': '.../assets/icons/icon.png', 'branding_logo': '.../assets/icons/icon_left_brand.svg', 'branding_title': 'authentik', 'default_locale': '', ...}
msg = None

    def assertEqual(self, first, second, msg=None):
        """Fail if the two objects are unequal as determined by the '=='
           operator.
        """
        assertion_func = self._getAssertEqualityFunc(first, second)
>       assertion_func(first, second, msg=msg)

.../hostedtoolcache/Python/3.12.9................../x64/lib/python3.12/unittest/case.py:885: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <authentik.brands.tests.TestBrands testMethod=test_fallback>
d1 = {'branding_custom_css': '', 'branding_favicon': '.../assets/icons/icon.png', 'branding_logo': '.../assets/icons/icon_left_brand.svg', 'branding_title': 'authentik', ...}
d2 = {'branding_favicon': '.../assets/icons/icon.png', 'branding_logo': '.../assets/icons/icon_left_brand.svg', 'branding_title': 'authentik', 'default_locale': '', ...}
msg = None

    def assertDictEqual(self, d1, d2, msg=None):
        self.assertIsInstance(d1, dict, 'First argument is not a dictionary')
        self.assertIsInstance(d2, dict, 'Second argument is not a dictionary')
    
        if d1 != d2:
            standardMsg = '%s != %s' % _common_shorten_repr(d1, d2)
            diff = ('\n' + '\n'.join(difflib.ndiff(
                           pprint.pformat(d1).splitlines(),
                           pprint.pformat(d2).splitlines())))
            standardMsg = self._truncateMessage(standardMsg, diff)
>           self.fail(self._formatMessage(msg, standardMsg))

.../hostedtoolcache/Python/3.12.9................../x64/lib/python3.12/unittest/case.py:1184: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <authentik.brands.tests.TestBrands testMethod=test_fallback>
msg = "{'matched_domain': 'fallback', 'branding_ti[234 chars]: ''} != {'branding_logo': '.../dist/assets/icon[212 chars]...matched_domain': 'fallback',\n   'ui_footer_links': [],\n-  'ui_theme': 'automatic'}\n+  'ui_theme': Themes.AUTOMATIC}"

    def fail(self, msg=None):
        """Fail immediately, with the given message."""
>       raise self.failureException(msg)
E       AssertionError: {'matched_domain': 'fallback', 'branding_ti[234 chars]: ''} != {'branding_logo': '.../dist/assets/icon[212 chars]: ''}
E       - {'branding_custom_css': '',
E       -  'branding_favicon': '.../assets/icons/icon.png',
E       ? ^
E       
E       + {'branding_favicon': '.../assets/icons/icon.png',
E       ? ^
E       
E          'branding_logo': '.../assets/icons/icon_left_brand.svg',
E          'branding_title': 'authentik',
E          'default_locale': '',
E          'matched_domain': 'fallback',
E          'ui_footer_links': [],
E       -  'ui_theme': 'automatic'}
E       +  'ui_theme': Themes.AUTOMATIC}

.../hostedtoolcache/Python/3.12.9................../x64/lib/python3.12/unittest/case.py:715: AssertionError

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant