Browse Source

Dev version: auto-subscribe TestUser to ~testing

merge-requests/68/head
Deimos 6 years ago
parent
commit
7bd44800cd
  1. 15
      tildes/scripts/initialize_db.py

15
tildes/scripts/initialize_db.py

@ -15,7 +15,7 @@ from sqlalchemy.engine import Connectable, Engine
from tildes.database_models import * # noqa
from tildes.lib.database import get_session_from_config
from tildes.models import DatabaseModel
from tildes.models.group import Group
from tildes.models.group import Group, GroupSubscription
from tildes.models.log import Log
from tildes.models.user import User
@ -77,13 +77,10 @@ def insert_dev_data(config_path: str) -> None:
"""Load the app config and insert some "starter" data for a dev version."""
session = get_session_from_config(config_path)
session.add_all(
[
User("TestUser", "password"),
Group(
"testing", "An automatically created group to use for testing purposes"
),
]
)
user = User("TestUser", "password")
group = Group("testing", "An automatically created group to use for testing")
subscription = GroupSubscription(user, group)
session.add_all([user, group, subscription])
session.commit()
Loading…
Cancel
Save