Skip to content

Commit

Permalink
Merge pull request #3672 from kushaldas/create_stage_user
Browse files Browse the repository at this point in the history
Adds --staging flag create-dev-data.py for tests
  • Loading branch information
msheiny authored Aug 13, 2018
2 parents a4c0252 + b08a0d7 commit 1eb2895
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 1eb2895

Please sign in to comment.