mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2025-01-09 08:45:28 +00:00
Set default auth user group to editor on initdb
This commit is contained in:
parent
7ae983acdf
commit
c991733c8d
2 changed files with 12 additions and 0 deletions
|
@ -117,10 +117,12 @@ def init_connectors():
|
||||||
|
|
||||||
def init_settings():
|
def init_settings():
|
||||||
"""info about the instance"""
|
"""info about the instance"""
|
||||||
|
group_editor = Group.objects.filter(name="editor").first()
|
||||||
models.SiteSettings.objects.create(
|
models.SiteSettings.objects.create(
|
||||||
support_link="https://www.patreon.com/bookwyrm",
|
support_link="https://www.patreon.com/bookwyrm",
|
||||||
support_title="Patreon",
|
support_title="Patreon",
|
||||||
install_mode=True,
|
install_mode=True,
|
||||||
|
default_user_auth_group=group_editor,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -63,9 +63,19 @@ class InitDB(TestCase):
|
||||||
|
|
||||||
def test_init_settings(self):
|
def test_init_settings(self):
|
||||||
"""Create the settings file"""
|
"""Create the settings file"""
|
||||||
|
initdb.init_groups()
|
||||||
|
group_editor = Group.objects.get(name="editor")
|
||||||
|
|
||||||
initdb.init_settings()
|
initdb.init_settings()
|
||||||
settings = models.SiteSettings.objects.get()
|
settings = models.SiteSettings.objects.get()
|
||||||
self.assertEqual(settings.name, "BookWyrm")
|
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):
|
def test_init_link_domains(self):
|
||||||
"""Common trusted domains for links"""
|
"""Common trusted domains for links"""
|
||||||
|
|
Loading…
Reference in a new issue