Skip to content

Commit

Permalink
Adds --staging flag create-dev-data.py for tests
Browse files Browse the repository at this point in the history
We now have --staging flag to the create-dev-data.py script so
that we can easily create an user in the staging or prodcution test
and then use the functional tests to test the instance.
  • Loading branch information
kushaldas authored and msheiny committed Aug 9, 2018
1 parent a4c0252 commit b08a0d7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions securedrop/create-dev-data.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

import datetime
import os
import sys
import argparse
from sqlalchemy.exc import IntegrityError

os.environ["SECUREDROP_ENV"] = "dev" # noqa
Expand Down Expand Up @@ -74,10 +76,19 @@ def create_source_and_submissions(num_submissions=2):
test_password = "correct horse battery staple profanity oil chewy"
test_otp_secret = "JHCOGO7VCER3EJ4L"

parser = argparse.ArgumentParser()
parser.add_argument("--staging", help="Adding user for staging tests.",
action="store_true")
args = parser.parse_args()
add_test_user("journalist",
test_password,
test_otp_secret,
is_admin=True)

# If staging, we only need the journalist user (admin)
if args.staging:
sys.exit(0)

add_test_user("dellsberg",
test_password,
test_otp_secret,
Expand Down
2 changes: 1 addition & 1 deletion securedrop/tests/functional/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
- `sudo -u www-data bash`
- `cd /var/wwww/securedrop/`
- `./manage.py reset` # This will clean the DB for testing
- `./create-demo-user.py`
- `./create-dev-data.py --staging`

Update this information to the `tests/functional/instance_information.json file.

Expand Down

0 comments on commit b08a0d7

Please sign in to comment.