forked from lucyparsons/OpenOversight
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_data.py
executable file
·32 lines (25 loc) · 938 Bytes
/
test_data.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/python
import argparse
from OpenOversight.app import create_app
from OpenOversight.app.models import db
from OpenOversight.tests.conftest import add_mockdata
app = create_app('development')
ctx = app.app_context()
ctx.push()
db.app = app
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("-p", "--populate", action='store_true',
help="populate the database with test data")
parser.add_argument("-c", "--cleanup", action='store_true',
help="delete all test data from the database")
args = parser.parse_args()
if args.populate:
print("[*] Populating database with test data...")
add_mockdata(db.session)
print("[*] Completed successfully!")
if args.cleanup:
print("[*] Cleaning up database...")
db.drop_all()
db.create_all()
print("[*] Completed successfully!")