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

Remove sites framework #913

Merged
merged 2 commits into from
Jan 24, 2024
Merged

Remove sites framework #913

merged 2 commits into from
Jan 24, 2024

Conversation

bufke
Copy link
Contributor

@bufke bufke commented Jan 5, 2024

Remove Django sites framework, which duplicates functionality of existing django settings.

Resolves TASK-424

Notes

  • Review user_auth.py change

For reference, the default is:

In [6]: site.name
Out[6]: 'example.com'
In [7]: site.domain
Out[7]: 'example.com'
In [10]: settings.KOBOCAT_PUBLIC_HOSTNAME
Out[10]: 'kc.kobotoolbox.org'

@bufke bufke self-assigned this Jan 5, 2024
@bufke bufke marked this pull request as ready for review January 8, 2024 18:56
@jnm jnm requested a review from noliveleger January 9, 2024 00:28
@jnm jnm assigned noliveleger and unassigned bufke Jan 9, 2024
context = site_name(None)
self.assertEqual(context, {'SITE_NAME': 'example.org'})
settings.SITE_ID = restore_site_id
self.assertEqual(context, {'SITE_NAME': 'kc.kobotoolbox.org'})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does not pass locally (because my domain name is not kc.kobotoolbox.org)
I guess we could use something like:

from django.test import override_settings

class CustomContextProcessorsTest(TestCase):
    @override_settings(KOBOCAT_PUBLIC_SUBDOMAIN='kc.domain.tld')
    def test_site_name(self):
         context = site_name(None)
         self.assertEqual(context, {'SITE_NAME': 'kc.domain.tld'})

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested by setting KOBOCAT_PUBLIC_SUBDOMAIN to another value. Test failed. With recent commit, it now passes. The specific override needs to be "KOBOCAT_PUBLIC_HOSTNAME"

@bufke bufke requested a review from noliveleger January 23, 2024 17:03
@noliveleger noliveleger merged commit 523fcce into beta Jan 24, 2024
3 checks passed
@noliveleger noliveleger deleted the remove-sites branch January 24, 2024 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants