Include scripts in formatting
This commit is contained in:
parent
c9639435aa
commit
1cd015a862
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
FILES_TO_FORMAT="atst/ tests/ app.py"
|
||||
FILES_TO_FORMAT="atst/ tests/ app.py script/"
|
||||
|
||||
if [ "$1" == "check" ]; then
|
||||
pipenv run black --check ${FILES_TO_FORMAT}
|
||||
|
@ -4,7 +4,8 @@ import csv
|
||||
# Add root project dir to the python path
|
||||
import os
|
||||
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)
|
||||
|
||||
from atst.app import make_app, make_config
|
||||
@ -16,9 +17,10 @@ def get_pe_numbers(url):
|
||||
t = response.read().decode("utf-8")
|
||||
return list(csv.reader(t.split("\r\n")))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
config = make_config()
|
||||
url = config['PE_NUMBER_CSV_URL']
|
||||
url = config["PE_NUMBER_CSV_URL"]
|
||||
print("Fetching PE numbers from {}".format(url))
|
||||
pe_numbers = get_pe_numbers(url)
|
||||
|
||||
|
@ -41,19 +41,21 @@ dod_ids = [
|
||||
"4567890123",
|
||||
"5678901234",
|
||||
"6789012345",
|
||||
"2342342342", # Andy
|
||||
"3453453453", # Sally
|
||||
"4564564564", # Betty
|
||||
"2342342342", # Andy
|
||||
"3453453453", # Sally
|
||||
"4564564564", # Betty
|
||||
"6786786786",
|
||||
]
|
||||
|
||||
|
||||
def create_demo_portfolio(name, data):
|
||||
try:
|
||||
portfolio_owner = Users.get_by_dod_id("678678678") # Other
|
||||
auditor = Users.get_by_dod_id("3453453453") # Sally
|
||||
portfolio_owner = Users.get_by_dod_id("678678678") # Other
|
||||
auditor = Users.get_by_dod_id("3453453453") # Sally
|
||||
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
|
||||
|
||||
request = RequestFactory.build(creator=portfolio_owner)
|
||||
@ -64,10 +66,12 @@ def create_demo_portfolio(name, data):
|
||||
approved_request = Requests.set_status(request, RequestStatus.APPROVED)
|
||||
|
||||
portfolio = Requests.approve_and_create_portfolio(request)
|
||||
portfolios.update(portfolio, { "name": name })
|
||||
portfolios.update(portfolio, {"name": name})
|
||||
|
||||
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]
|
||||
envs = Environments.create_many(application, env_names)
|
||||
db.session.add(application)
|
||||
@ -153,5 +157,9 @@ if __name__ == "__main__":
|
||||
app = make_app(config)
|
||||
with app.app_context():
|
||||
remove_sample_data()
|
||||
create_demo_portfolio('Aardvark', MockReportingProvider.REPORT_FIXTURE_MAP["Aardvark"])
|
||||
create_demo_portfolio('Beluga', MockReportingProvider.REPORT_FIXTURE_MAP["Beluga"])
|
||||
create_demo_portfolio(
|
||||
"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",
|
||||
"portfolio_role": "developer",
|
||||
"dod_id": "0000000004",
|
||||
"status": InvitationStatus.REJECTED_WRONG_USER
|
||||
"status": InvitationStatus.REJECTED_WRONG_USER,
|
||||
},
|
||||
{
|
||||
"first_name": "Gina",
|
||||
@ -56,7 +56,7 @@ PORTFOLIO_INVITED_USERS = [
|
||||
"email": "gina@mil.gov",
|
||||
"portfolio_role": "developer",
|
||||
"dod_id": "0000000005",
|
||||
"status": InvitationStatus.REJECTED_EXPIRED
|
||||
"status": InvitationStatus.REJECTED_EXPIRED,
|
||||
},
|
||||
{
|
||||
"first_name": "Hector",
|
||||
@ -64,7 +64,7 @@ PORTFOLIO_INVITED_USERS = [
|
||||
"email": "hector@mil.gov",
|
||||
"portfolio_role": "developer",
|
||||
"dod_id": "0000000006",
|
||||
"status": InvitationStatus.REVOKED
|
||||
"status": InvitationStatus.REVOKED,
|
||||
},
|
||||
{
|
||||
"first_name": "Isabella",
|
||||
@ -72,7 +72,7 @@ PORTFOLIO_INVITED_USERS = [
|
||||
"email": "isabella@mil.gov",
|
||||
"portfolio_role": "developer",
|
||||
"dod_id": "0000000007",
|
||||
"status": InvitationStatus.PENDING
|
||||
"status": InvitationStatus.PENDING,
|
||||
},
|
||||
]
|
||||
|
||||
@ -92,7 +92,7 @@ def seed_db():
|
||||
continue
|
||||
|
||||
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.latest_revision.dollar_value = dollar_value
|
||||
db.session.add(request)
|
||||
@ -117,7 +117,9 @@ def seed_db():
|
||||
|
||||
for portfolio_role in PORTFOLIO_INVITED_USERS:
|
||||
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.commit()
|
||||
|
Loading…
x
Reference in New Issue
Block a user