ccpo should see request approval screen for all request

This commit is contained in:
dandds 2018-09-04 17:28:16 -04:00
parent a96af2d095
commit 038cceb34b
4 changed files with 29 additions and 43 deletions

View File

@ -1,9 +1,11 @@
from flask import render_template
from flask import render_template, g
from . import requests_bp
from atst.forms.data import SERVICE_BRANCHES
from atst.domain.requests import Requests
@requests_bp.route("/request_approval", methods=["GET"])
def requests_approval():
return render_template("request_approval.html", service_branches=SERVICE_BRANCHES)
@requests_bp.route("/requests/approval/<string:request_id>", methods=["GET"])
def approval(request_id):
request = Requests.get(g.current_user, request_id)
return render_template("requests/approval.html", data=request.body, service_branches=SERVICE_BRANCHES)

View File

@ -70,7 +70,9 @@ class RequestsIndex(object):
else "-"
)
if Requests.is_pending_financial_verification(request):
if viewing_role == "ccpo":
edit_link = url_for("requests.approval", request_id=request.id)
elif Requests.is_pending_financial_verification(request):
edit_link = url_for(
"requests.financial_verification", request_id=request.id
)

View File

@ -18,44 +18,7 @@
<p>Ongoing maintainence for Death Star (a moon-sized Imperial military battlestation armed with a planet-destroying superlaser). Its definitely hasn't been sabotaged from the start.</p>
{% with data = {
"primary_poc": {
"am_poc": False,
"dodid_poc": "1234567890",
"email_poc": "fake@email.com",
"fname_poc": "Amanda",
"lname_poc": "Adamson",
},
"details_of_use": {
"jedi_usage": "adf",
"start_date": "2018-08-08",
"cloud_native": "yes",
"dollar_value": 500000,
"dod_component": "Air Force, Department of the",
"data_transfers": "Less than 100GB",
"expected_completion_date": "Less than 1 month",
"jedi_migration": "yes",
"num_software_systems": 1,
"number_user_sessions": 2,
"average_daily_traffic": 1,
"engineering_assessment": "yes",
"technical_support_team": "yes",
"estimated_monthly_spend": 100,
"average_daily_traffic_gb": 4,
"rationalization_software_systems": "yes",
"organization_providing_assistance": "In-house staff",
},
"information_about_you": {
"citizenship": "United States",
"designation": "military",
"phone_number": "1234567890",
"email_request": "fake@email.mil",
"fname_request": "Amanda",
"lname_request": "Adamson",
"service_branch": "Air Force, Department of the",
"date_latest_training": "2018-08-06",
}
}, service_branches=service_branches %}
{% with data=data, service_branches=service_branches %}
{% include "requests/_review.html" %}
{% endwith %}

View File

@ -1,3 +1,5 @@
from flask import url_for
from atst.routes.requests.index import RequestsIndex
from tests.factories import RequestFactory, UserFactory
from atst.domain.requests import Requests
@ -21,3 +23,20 @@ def test_action_required_ccpo():
context = RequestsIndex(ccpo).execute()
assert context["num_action_required"] == 1
def test_ccpo_sees_approval_screen():
ccpo = UserFactory.from_atat_role("ccpo")
request = RequestFactory.create()
Requests.submit(request)
ccpo_context = RequestsIndex(ccpo).execute()
assert (
ccpo_context["requests"][0]["edit_link"]
== url_for("requests.approval", request_id=request.id)
)
mo_context = RequestsIndex(request.creator).execute()
assert (
mo_context["requests"][0]["edit_link"]
!= url_for("requests.approval", request_id=request.id)
)