Include scripts in formatting
This commit is contained in:
parent
c9639435aa
commit
1cd015a862
@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
FILES_TO_FORMAT="atst/ tests/ app.py"
|
FILES_TO_FORMAT="atst/ tests/ app.py script/"
|
||||||
|
|
||||||
if [ "$1" == "check" ]; then
|
if [ "$1" == "check" ]; then
|
||||||
pipenv run black --check ${FILES_TO_FORMAT}
|
pipenv run black --check ${FILES_TO_FORMAT}
|
||||||
|
@ -4,7 +4,8 @@ import csv
|
|||||||
# Add root project dir to the python path
|
# Add root project dir to the python path
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
parent_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
|
|
||||||
|
parent_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
|
||||||
sys.path.append(parent_dir)
|
sys.path.append(parent_dir)
|
||||||
|
|
||||||
from atst.app import make_app, make_config
|
from atst.app import make_app, make_config
|
||||||
@ -16,9 +17,10 @@ def get_pe_numbers(url):
|
|||||||
t = response.read().decode("utf-8")
|
t = response.read().decode("utf-8")
|
||||||
return list(csv.reader(t.split("\r\n")))
|
return list(csv.reader(t.split("\r\n")))
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
config = make_config()
|
config = make_config()
|
||||||
url = config['PE_NUMBER_CSV_URL']
|
url = config["PE_NUMBER_CSV_URL"]
|
||||||
print("Fetching PE numbers from {}".format(url))
|
print("Fetching PE numbers from {}".format(url))
|
||||||
pe_numbers = get_pe_numbers(url)
|
pe_numbers = get_pe_numbers(url)
|
||||||
|
|
||||||
|
@ -53,7 +53,9 @@ def create_demo_portfolio(name, data):
|
|||||||
portfolio_owner = Users.get_by_dod_id("678678678") # Other
|
portfolio_owner = Users.get_by_dod_id("678678678") # Other
|
||||||
auditor = Users.get_by_dod_id("3453453453") # Sally
|
auditor = Users.get_by_dod_id("3453453453") # Sally
|
||||||
except NotFoundError:
|
except NotFoundError:
|
||||||
print("Could not find demo users; will not create demo portfolio {}".format(name))
|
print(
|
||||||
|
"Could not find demo users; will not create demo portfolio {}".format(name)
|
||||||
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
request = RequestFactory.build(creator=portfolio_owner)
|
request = RequestFactory.build(creator=portfolio_owner)
|
||||||
@ -64,10 +66,12 @@ def create_demo_portfolio(name, data):
|
|||||||
approved_request = Requests.set_status(request, RequestStatus.APPROVED)
|
approved_request = Requests.set_status(request, RequestStatus.APPROVED)
|
||||||
|
|
||||||
portfolio = Requests.approve_and_create_portfolio(request)
|
portfolio = Requests.approve_and_create_portfolio(request)
|
||||||
portfolios.update(portfolio, { "name": name })
|
portfolios.update(portfolio, {"name": name})
|
||||||
|
|
||||||
for mock_application in data["applications"]:
|
for mock_application in data["applications"]:
|
||||||
application = application(portfolio=portfolio, name=mock_application.name, description='')
|
application = application(
|
||||||
|
portfolio=portfolio, name=mock_application.name, description=""
|
||||||
|
)
|
||||||
env_names = [env.name for env in mock_application.environments]
|
env_names = [env.name for env in mock_application.environments]
|
||||||
envs = Environments.create_many(application, env_names)
|
envs = Environments.create_many(application, env_names)
|
||||||
db.session.add(application)
|
db.session.add(application)
|
||||||
@ -153,5 +157,9 @@ if __name__ == "__main__":
|
|||||||
app = make_app(config)
|
app = make_app(config)
|
||||||
with app.app_context():
|
with app.app_context():
|
||||||
remove_sample_data()
|
remove_sample_data()
|
||||||
create_demo_portfolio('Aardvark', MockReportingProvider.REPORT_FIXTURE_MAP["Aardvark"])
|
create_demo_portfolio(
|
||||||
create_demo_portfolio('Beluga', MockReportingProvider.REPORT_FIXTURE_MAP["Beluga"])
|
"Aardvark", MockReportingProvider.REPORT_FIXTURE_MAP["Aardvark"]
|
||||||
|
)
|
||||||
|
create_demo_portfolio(
|
||||||
|
"Beluga", MockReportingProvider.REPORT_FIXTURE_MAP["Beluga"]
|
||||||
|
)
|
||||||
|
@ -48,7 +48,7 @@ PORTFOLIO_INVITED_USERS = [
|
|||||||
"email": "frederick@mil.gov",
|
"email": "frederick@mil.gov",
|
||||||
"portfolio_role": "developer",
|
"portfolio_role": "developer",
|
||||||
"dod_id": "0000000004",
|
"dod_id": "0000000004",
|
||||||
"status": InvitationStatus.REJECTED_WRONG_USER
|
"status": InvitationStatus.REJECTED_WRONG_USER,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"first_name": "Gina",
|
"first_name": "Gina",
|
||||||
@ -56,7 +56,7 @@ PORTFOLIO_INVITED_USERS = [
|
|||||||
"email": "gina@mil.gov",
|
"email": "gina@mil.gov",
|
||||||
"portfolio_role": "developer",
|
"portfolio_role": "developer",
|
||||||
"dod_id": "0000000005",
|
"dod_id": "0000000005",
|
||||||
"status": InvitationStatus.REJECTED_EXPIRED
|
"status": InvitationStatus.REJECTED_EXPIRED,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"first_name": "Hector",
|
"first_name": "Hector",
|
||||||
@ -64,7 +64,7 @@ PORTFOLIO_INVITED_USERS = [
|
|||||||
"email": "hector@mil.gov",
|
"email": "hector@mil.gov",
|
||||||
"portfolio_role": "developer",
|
"portfolio_role": "developer",
|
||||||
"dod_id": "0000000006",
|
"dod_id": "0000000006",
|
||||||
"status": InvitationStatus.REVOKED
|
"status": InvitationStatus.REVOKED,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"first_name": "Isabella",
|
"first_name": "Isabella",
|
||||||
@ -72,7 +72,7 @@ PORTFOLIO_INVITED_USERS = [
|
|||||||
"email": "isabella@mil.gov",
|
"email": "isabella@mil.gov",
|
||||||
"portfolio_role": "developer",
|
"portfolio_role": "developer",
|
||||||
"dod_id": "0000000007",
|
"dod_id": "0000000007",
|
||||||
"status": InvitationStatus.PENDING
|
"status": InvitationStatus.PENDING,
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -92,7 +92,7 @@ def seed_db():
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
requests = []
|
requests = []
|
||||||
for dollar_value in [1, 200, 3000, 40000, 500000, 1000000]:
|
for dollar_value in [1, 200, 3000, 40000, 500_000, 1_000_000]:
|
||||||
request = RequestFactory.build(creator=user)
|
request = RequestFactory.build(creator=user)
|
||||||
request.latest_revision.dollar_value = dollar_value
|
request.latest_revision.dollar_value = dollar_value
|
||||||
db.session.add(request)
|
db.session.add(request)
|
||||||
@ -117,7 +117,9 @@ def seed_db():
|
|||||||
|
|
||||||
for portfolio_role in PORTFOLIO_INVITED_USERS:
|
for portfolio_role in PORTFOLIO_INVITED_USERS:
|
||||||
ws_role = Portfolios.create_member(user, portfolio, portfolio_role)
|
ws_role = Portfolios.create_member(user, portfolio, portfolio_role)
|
||||||
invitation = InvitationFactory.build(portfolio_role=ws_role, status=portfolio_role["status"])
|
invitation = InvitationFactory.build(
|
||||||
|
portfolio_role=ws_role, status=portfolio_role["status"]
|
||||||
|
)
|
||||||
db.session.add(invitation)
|
db.session.add(invitation)
|
||||||
|
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user