We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
[functional testing] Fix staging CI job on tbb-0.9.0
We removed the application/functional test run from the staging environment in #3697. We should also update the testinfra test references and remove the application test run from CI, otherwise we get a few testinfra test failures due to pip deps, and an error when we attempt to run the application tests in CI: 

```
TASK [Run application tests] ***************************************************
    Friday 10 August 2018  19:28:17 +0000 (0:00:00.037)       0:01:08.223 *********
    fatal: [app-staging]: FAILED! => {"changed": true, "msg": "non-zero return code", "rc": 127, "stderr": "Shared connection to 52.36.194.59 closed.\r\n", "stdout": "/home/sdrop/.ansible/tmp/ansible-tmp-1533929297.62-93522333058246/app-tests.sh: line 13: pytest: command not found\r\n", "stdout_lines": ["/home/sdrop/.ansible/tmp/ansible-tmp-1533929297.62-93522333058246/app-tests.sh: line 13: pytest: command not found"]}
    ...ignoring
```

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `securedrop/create-dev-data.py`
Content:
```
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 
4 import datetime
5 import os
6 import sys
7 import argparse
8 from sqlalchemy.exc import IntegrityError
9 
10 os.environ["SECUREDROP_ENV"] = "dev"  # noqa
11 import journalist_app
12 from sdconfig import config
13 from db import db
14 from models import Journalist, Source, Submission
15 
16 
17 def add_test_user(username, password, otp_secret, is_admin=False):
18     context = journalist_app.create_app(config).app_context()
19     context.push()
20 
21     try:
22         user = Journalist(username=username,
23                           password=password,
24                           is_admin=is_admin)
25         user.otp_secret = otp_secret
26         db.session.add(user)
27         db.session.commit()
28         print('Test user successfully added: '
29               'username={}, password={}, otp_secret={}, is_admin={}'
30               ''.format(username, password, otp_secret, is_admin))
31     except IntegrityError:
32         print("Test user already added")
33         db.session.rollback()
34 
35     context.pop()
36 
37 
38 def create_source_and_submissions(num_submissions=2):
39     app = journalist_app.create_app(config)
40 
41     with app.app_context():
42         # Store source in database
43         codename = app.crypto_util.genrandomid()
44         filesystem_id = app.crypto_util.hash_codename(codename)
45         journalist_designation = app.crypto_util.display_id()
46         source = Source(filesystem_id, journalist_designation)
47         source.pending = False
48         db.session.add(source)
49         db.session.commit()
50 
51         # Generate submissions directory and generate source key
52         os.mkdir(app.storage.path(source.filesystem_id))
53         app.crypto_util.genkeypair(source.filesystem_id, codename)
54 
55         # Generate some test submissions
56         for _ in range(num_submissions):
57             source.interaction_count += 1
58             fpath = app.storage.save_message_submission(
59                 source.filesystem_id,
60                 source.interaction_count,
61                 source.journalist_filename,
62                 'test submission!'
63             )
64             source.last_updated = datetime.datetime.utcnow()
65             submission = Submission(source, fpath)
66             db.session.add(submission)
67 
68         db.session.commit()
69         print("Test source '{}' added with {} submissions".format(
70             journalist_designation, num_submissions)
71         )
72 
73 
74 if __name__ == "__main__":  # pragma: no cover
75     # Add two test users
76     test_password = "correct horse battery staple profanity oil chewy"
77     test_otp_secret = "JHCOGO7VCER3EJ4L"
78 
79     parser = argparse.ArgumentParser()
80     parser.add_argument("--staging", help="Adding user for staging tests.",
81                     action="store_true")
82     args = parser.parse_args()
83     add_test_user("journalist",
84                   test_password,
85                   test_otp_secret,
86                   is_admin=True)
87 
88     # If staging, we only need the journalist user (admin)
89     if args.staging:
90         sys.exit(0)
91 
92     add_test_user("dellsberg",
93                   test_password,
94                   test_otp_secret,
95                   is_admin=False)
96 
97     # Add test sources and submissions
98     num_sources = 2
99     for _ in range(num_sources):
100         create_source_and_submissions()
101
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/securedrop/create-dev-data.py b/securedrop/create-dev-data.py
--- a/securedrop/create-dev-data.py
+++ b/securedrop/create-dev-data.py
@@ -78,7 +78,7 @@
 
     parser = argparse.ArgumentParser()
     parser.add_argument("--staging", help="Adding user for staging tests.",
-                    action="store_true")
+                        action="store_true")
     args = parser.parse_args()
     add_test_user("journalist",
                   test_password,

{"golden_diff": "diff --git a/securedrop/create-dev-data.py b/securedrop/create-dev-data.py\n--- a/securedrop/create-dev-data.py\n+++ b/securedrop/create-dev-data.py\n@@ -78,7 +78,7 @@\n \n     parser = argparse.ArgumentParser()\n     parser.add_argument(\"--staging\", help=\"Adding user for staging tests.\",\n-                    action=\"store_true\")\n+                        action=\"store_true\")\n     args = parser.parse_args()\n     add_test_user(\"journalist\",\n                   test_password,\n", "issue": "[functional testing] Fix staging CI job on tbb-0.9.0\nWe removed the application/functional test run from the staging environment in #3697. We should also update the testinfra test references and remove the application test run from CI, otherwise we get a few testinfra test failures due to pip deps, and an error when we attempt to run the application tests in CI: \r\n\r\n```\r\nTASK [Run application tests] ***************************************************\r\n    Friday 10 August 2018  19:28:17 +0000 (0:00:00.037)       0:01:08.223 *********\r\n    fatal: [app-staging]: FAILED! => {\"changed\": true, \"msg\": \"non-zero return code\", \"rc\": 127, \"stderr\": \"Shared connection to 52.36.194.59 closed.\\r\\n\", \"stdout\": \"/home/sdrop/.ansible/tmp/ansible-tmp-1533929297.62-93522333058246/app-tests.sh: line 13: pytest: command not found\\r\\n\", \"stdout_lines\": [\"/home/sdrop/.ansible/tmp/ansible-tmp-1533929297.62-93522333058246/app-tests.sh: line 13: pytest: command not found\"]}\r\n    ...ignoring\r\n```\n", "before_files": [{"content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport datetime\nimport os\nimport sys\nimport argparse\nfrom sqlalchemy.exc import IntegrityError\n\nos.environ[\"SECUREDROP_ENV\"] = \"dev\"  # noqa\nimport journalist_app\nfrom sdconfig import config\nfrom db import db\nfrom models import Journalist, Source, Submission\n\n\ndef add_test_user(username, password, otp_secret, is_admin=False):\n    context = journalist_app.create_app(config).app_context()\n    context.push()\n\n    try:\n        user = Journalist(username=username,\n                          password=password,\n                          is_admin=is_admin)\n        user.otp_secret = otp_secret\n        db.session.add(user)\n        db.session.commit()\n        print('Test user successfully added: '\n              'username={}, password={}, otp_secret={}, is_admin={}'\n              ''.format(username, password, otp_secret, is_admin))\n    except IntegrityError:\n        print(\"Test user already added\")\n        db.session.rollback()\n\n    context.pop()\n\n\ndef create_source_and_submissions(num_submissions=2):\n    app = journalist_app.create_app(config)\n\n    with app.app_context():\n        # Store source in database\n        codename = app.crypto_util.genrandomid()\n        filesystem_id = app.crypto_util.hash_codename(codename)\n        journalist_designation = app.crypto_util.display_id()\n        source = Source(filesystem_id, journalist_designation)\n        source.pending = False\n        db.session.add(source)\n        db.session.commit()\n\n        # Generate submissions directory and generate source key\n        os.mkdir(app.storage.path(source.filesystem_id))\n        app.crypto_util.genkeypair(source.filesystem_id, codename)\n\n        # Generate some test submissions\n        for _ in range(num_submissions):\n            source.interaction_count += 1\n            fpath = app.storage.save_message_submission(\n                source.filesystem_id,\n                source.interaction_count,\n                source.journalist_filename,\n                'test submission!'\n            )\n            source.last_updated = datetime.datetime.utcnow()\n            submission = Submission(source, fpath)\n            db.session.add(submission)\n\n        db.session.commit()\n        print(\"Test source '{}' added with {} submissions\".format(\n            journalist_designation, num_submissions)\n        )\n\n\nif __name__ == \"__main__\":  # pragma: no cover\n    # Add two test users\n    test_password = \"correct horse battery staple profanity oil chewy\"\n    test_otp_secret = \"JHCOGO7VCER3EJ4L\"\n\n    parser = argparse.ArgumentParser()\n    parser.add_argument(\"--staging\", help=\"Adding user for staging tests.\",\n                    action=\"store_true\")\n    args = parser.parse_args()\n    add_test_user(\"journalist\",\n                  test_password,\n                  test_otp_secret,\n                  is_admin=True)\n\n    # If staging, we only need the journalist user (admin)\n    if args.staging:\n        sys.exit(0)\n\n    add_test_user(\"dellsberg\",\n                  test_password,\n                  test_otp_secret,\n                  is_admin=False)\n\n    # Add test sources and submissions\n    num_sources = 2\n    for _ in range(num_sources):\n        create_source_and_submissions()\n", "path": "securedrop/create-dev-data.py"}], "after_files": [{"content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport datetime\nimport os\nimport sys\nimport argparse\nfrom sqlalchemy.exc import IntegrityError\n\nos.environ[\"SECUREDROP_ENV\"] = \"dev\"  # noqa\nimport journalist_app\nfrom sdconfig import config\nfrom db import db\nfrom models import Journalist, Source, Submission\n\n\ndef add_test_user(username, password, otp_secret, is_admin=False):\n    context = journalist_app.create_app(config).app_context()\n    context.push()\n\n    try:\n        user = Journalist(username=username,\n                          password=password,\n                          is_admin=is_admin)\n        user.otp_secret = otp_secret\n        db.session.add(user)\n        db.session.commit()\n        print('Test user successfully added: '\n              'username={}, password={}, otp_secret={}, is_admin={}'\n              ''.format(username, password, otp_secret, is_admin))\n    except IntegrityError:\n        print(\"Test user already added\")\n        db.session.rollback()\n\n    context.pop()\n\n\ndef create_source_and_submissions(num_submissions=2):\n    app = journalist_app.create_app(config)\n\n    with app.app_context():\n        # Store source in database\n        codename = app.crypto_util.genrandomid()\n        filesystem_id = app.crypto_util.hash_codename(codename)\n        journalist_designation = app.crypto_util.display_id()\n        source = Source(filesystem_id, journalist_designation)\n        source.pending = False\n        db.session.add(source)\n        db.session.commit()\n\n        # Generate submissions directory and generate source key\n        os.mkdir(app.storage.path(source.filesystem_id))\n        app.crypto_util.genkeypair(source.filesystem_id, codename)\n\n        # Generate some test submissions\n        for _ in range(num_submissions):\n            source.interaction_count += 1\n            fpath = app.storage.save_message_submission(\n                source.filesystem_id,\n                source.interaction_count,\n                source.journalist_filename,\n                'test submission!'\n            )\n            source.last_updated = datetime.datetime.utcnow()\n            submission = Submission(source, fpath)\n            db.session.add(submission)\n\n        db.session.commit()\n        print(\"Test source '{}' added with {} submissions\".format(\n            journalist_designation, num_submissions)\n        )\n\n\nif __name__ == \"__main__\":  # pragma: no cover\n    # Add two test users\n    test_password = \"correct horse battery staple profanity oil chewy\"\n    test_otp_secret = \"JHCOGO7VCER3EJ4L\"\n\n    parser = argparse.ArgumentParser()\n    parser.add_argument(\"--staging\", help=\"Adding user for staging tests.\",\n                        action=\"store_true\")\n    args = parser.parse_args()\n    add_test_user(\"journalist\",\n                  test_password,\n                  test_otp_secret,\n                  is_admin=True)\n\n    # If staging, we only need the journalist user (admin)\n    if args.staging:\n        sys.exit(0)\n\n    add_test_user(\"dellsberg\",\n                  test_password,\n                  test_otp_secret,\n                  is_admin=False)\n\n    # Add test sources and submissions\n    num_sources = 2\n    for _ in range(num_sources):\n        create_source_and_submissions()\n", "path": "securedrop/create-dev-data.py"}]}