diff --git a/README.md b/README.md index 18744a33..e6c6f1c3 100644 --- a/README.md +++ b/README.md @@ -104,6 +104,13 @@ For example `/login-dev?username=amanda`. In development mode, there is a `DEV Login` button available on the home page that will automatically log you in as Amanda. +### Seeding the database + +We have a helper script that will seed the database with requests, workspaces and +projects for all of the test users: + +`pipenv run python script/seed.py` + ## Testing Tests require a test database: diff --git a/script/seed.py b/script/seed.py index 03bbbb5c..9b4c64a0 100644 --- a/script/seed.py +++ b/script/seed.py @@ -5,6 +5,7 @@ import sys parent_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), "..")) sys.path.append(parent_dir) +from atst.database import db from atst.app import make_config, make_app from atst.domain.users import Users from atst.domain.requests import Requests @@ -27,9 +28,11 @@ def seed_db(): for user in users: requests = [] for dollar_value in [1, 200, 3000, 40000, 500000, 1000000]: - request = Requests.create( - user, RequestFactory.build_request_body(user, dollar_value) - ) + request = RequestFactory.build(creator=user) + request.latest_revision.dollar_value = dollar_value + db.session.add(request) + db.session.commit() + Requests.submit(request) requests.append(request)