Set default auth user group to editor on initdb

This commit is contained in:
Christof Dorner 2022-12-27 23:33:52 +01:00
parent 7ae983acdf
commit c991733c8d
2 changed files with 12 additions and 0 deletions

View file

@ -117,10 +117,12 @@ def init_connectors():
def init_settings():
"""info about the instance"""
group_editor = Group.objects.filter(name="editor").first()
models.SiteSettings.objects.create(
support_link="https://www.patreon.com/bookwyrm",
support_title="Patreon",
install_mode=True,
default_user_auth_group=group_editor,
)

View file

@ -63,9 +63,19 @@ class InitDB(TestCase):
def test_init_settings(self):
"""Create the settings file"""
initdb.init_groups()
group_editor = Group.objects.get(name="editor")
initdb.init_settings()
settings = models.SiteSettings.objects.get()
self.assertEqual(settings.name, "BookWyrm")
self.assertEqual(settings.default_user_auth_group, group_editor)
def test_init_settings_without_groups(self):
"""Create the settings, but without groups existing already"""
initdb.init_settings()
settings = models.SiteSettings.objects.get()
self.assertIsNone(settings.default_user_auth_group)
def test_init_link_domains(self):
"""Common trusted domains for links"""