diff --git a/atst/routes/requests/approval.py b/atst/routes/requests/approval.py index 8d16960a..ca4116c7 100644 --- a/atst/routes/requests/approval.py +++ b/atst/routes/requests/approval.py @@ -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/", 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) diff --git a/atst/routes/requests/index.py b/atst/routes/requests/index.py index fe3e894e..75be2c87 100644 --- a/atst/routes/requests/index.py +++ b/atst/routes/requests/index.py @@ -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 ) diff --git a/templates/requests/approval.html b/templates/requests/approval.html index 8cb2580a..6f9b8dd8 100644 --- a/templates/requests/approval.html +++ b/templates/requests/approval.html @@ -18,44 +18,7 @@

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.

- {% 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 %} diff --git a/tests/routes/test_requests_index.py b/tests/routes/test_requests_index.py index e33c7cb8..c8d6fa5d 100644 --- a/tests/routes/test_requests_index.py +++ b/tests/routes/test_requests_index.py @@ -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) + )