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

Add tests for default django templates that are overridden. #301

Open
fabiocaccamo opened this issue Jul 20, 2023 · 3 comments
Open

Add tests for default django templates that are overridden. #301

fabiocaccamo opened this issue Jul 20, 2023 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@fabiocaccamo
Copy link
Owner

fabiocaccamo commented Jul 20, 2023

Problem

Some features require template changes that now work correctly, but may become incompatible with future django releases.

Solution

Discover incompatibility issues as soon as possible using the CI by comparing the default django template (this will run for each supported django version in the CI) with a list of templates that we know are compatible with this library.
Doing this, any future change to an overridden template will immediately result in a CI failure, very easy to discover and debug.


Here there are all default django admin templates that are overridden by this package:
https://github.com/fabiocaccamo/django-admin-interface/tree/main/admin_interface/templates/admin

Funding

  • You can sponsor this specific effort via a Polar.sh pledge below
  • We receive the pledge once the issue is completed & verified
Fund with Polar
@merwok
Copy link
Contributor

merwok commented Jul 20, 2023

Is your idea to add special comments like {# begin d-a-i custom code #} around added lines?
What about changed lines?

@fabiocaccamo
Copy link
Owner Author

fabiocaccamo commented Jul 20, 2023

No, it's too hard comparing customized templates with the original ones, my idea is this:

Preparation

  • For each django version supported (also when adding new versions)
    • For each admin template that is overwritten by this library
      • copy template code from django repo to a path like
        tests/data/templates/admin/base_site.html.django-{{ django_version }}

Tests

  • For each template in this library that overrides a django admin template
    • Load the django original template that has been overwritten as string from the django installed in the current test environment
    • Expect the loaded template to match any template in
      tests/data/templates/admin/{{ template_name }}.django-{{ django_version }}
    • If a matching template is not found CI fails

What do you think about it?

@merwok
Copy link
Contributor

merwok commented Jul 20, 2023

Ah I understand, it’s an automated comparison of a saved copy with the upstream file! Plan seems good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Todo
Development

No branches or pull requests

2 participants