Review comment #160185269
This commit is contained in:
dandds 2018-09-17 14:29:07 -04:00 committed by GitHub
commit ff43c3d410
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 104 additions and 2 deletions

View File

@ -194,3 +194,13 @@ class Request(Base):
@property
def is_approved(self):
return self.status == RequestStatus.APPROVED
@property
def review_comment(self):
if (
self.status == RequestStatus.CHANGES_REQUESTED
or self.status == RequestStatus.CHANGES_REQUESTED_TO_FINVER
):
review = self.latest_status.review
if review:
return review.comment

View File

@ -39,6 +39,7 @@ def financial_verification(request_id=None):
"requests/financial_verification.html",
f=form,
request=request,
review_comment=request.review_comment,
extended=is_extended(request),
)

View File

@ -62,6 +62,7 @@ def requests_form_update(screen=1, request_id=None):
next_screen=screen + 1,
request_id=request_id,
jedi_request=jedi_flow.request,
review_comment=request.review_comment,
can_submit=jedi_flow.can_submit,
)

View File

@ -6,6 +6,10 @@
{% include 'requests/menu.html' %}
{% if review_comment %}
{% include 'requests/comment.html' %}
{% endif %}
{% block form_action %}
{% if request_id %}
<form method='POST' action="{{ url_for('requests.requests_form_update', screen=current, request_id=request_id) }}" autocomplete="off">

View File

@ -0,0 +1,9 @@
{% from "components/alert.html" import Alert %}
{% call Alert('Changes Requested', level='warning') %}
<p>CCPO has requested changes to your submission with the following notes:
<br>
{{ review_comment }}
<br>
Please contact info@jedi.cloud or 123-123-4567 for further discussion.</p>
{% endcall %}

View File

@ -12,6 +12,10 @@
{{ Alert('Pending Financial Verification', fragment="fragments/pending_financial_verification.html") }}
{% endif %}
{% if review_comment %}
{% include 'requests/comment.html' %}
{% endif %}
<financial inline-template v-bind:initial-data='{{ f.data|mixedContentToJson }}'>
<div class="col">

View File

@ -92,3 +92,26 @@ def test_reviews():
RequestStatusEventFactory.create(revision=request.latest_revision),
]
assert len(request.reviews) == 2
def test_review_comment():
request = RequestFactory.create()
ccpo = UserFactory.from_atat_role("ccpo")
request.status_events = [
RequestStatusEventFactory.create(
revision=request.latest_revision,
new_status=RequestStatus.CHANGES_REQUESTED,
review=RequestReviewFactory.create(reviewer=ccpo, comment="do better"),
)
]
assert request.review_comment == "do better"
request.status_events = [
RequestStatusEventFactory.create(
revision=request.latest_revision,
new_status=RequestStatus.APPROVED,
review=RequestReviewFactory.create(reviewer=ccpo, comment="much better"),
)
]
assert not request.review_comment

View File

@ -3,9 +3,16 @@ import pytest
from flask import url_for
from atst.eda_client import MockEDAClient
from atst.models.request_status_event import RequestStatus
from tests.mocks import MOCK_REQUEST, MOCK_USER
from tests.factories import PENumberFactory, RequestFactory, UserFactory
from tests.factories import (
PENumberFactory,
RequestFactory,
UserFactory,
RequestStatusEventFactory,
RequestReviewFactory,
)
class TestPENumberInForm:
@ -148,3 +155,21 @@ class TestPENumberInForm:
response = self.submit_data(client, user, data, extended=True)
assert response.status_code == 200
def test_displays_ccpo_review_comment(user_session, client):
creator = UserFactory.create()
ccpo = UserFactory.from_atat_role("ccpo")
user_session(creator)
request = RequestFactory.create(creator=creator)
review_comment = "add all of the correct info, instead of the incorrect info"
request.status_events = [
RequestStatusEventFactory.create(
revision=request.latest_revision,
new_status=RequestStatus.CHANGES_REQUESTED_TO_FINVER,
review=RequestReviewFactory.create(reviewer=ccpo, comment=review_comment),
)
]
response = client.get("/requests/verify/{}".format(request.id))
body = response.data.decode()
assert review_comment in body

View File

@ -1,5 +1,12 @@
import re
from tests.factories import RequestFactory, UserFactory, RequestRevisionFactory
from tests.factories import (
RequestFactory,
UserFactory,
RequestRevisionFactory,
RequestStatusEventFactory,
RequestReviewFactory,
)
from atst.models.request_status_event import RequestStatus
from atst.domain.roles import Roles
from atst.domain.requests import Requests
from urllib.parse import urlencode
@ -213,3 +220,21 @@ def test_can_review_data(user_session, client):
# assert a sampling of the request data is on the review page
assert request.body["primary_poc"]["fname_poc"] in body
assert request.body["information_about_you"]["email_request"] in body
def test_displays_ccpo_review_comment(user_session, client):
creator = UserFactory.create()
ccpo = UserFactory.from_atat_role("ccpo")
user_session(creator)
request = RequestFactory.create(creator=creator)
review_comment = "add all of the correct info, instead of the incorrect info"
request.status_events = [
RequestStatusEventFactory.create(
revision=request.latest_revision,
new_status=RequestStatus.CHANGES_REQUESTED,
review=RequestReviewFactory.create(reviewer=ccpo, comment=review_comment),
)
]
response = client.get("/requests/new/1/{}".format(request.id))
body = response.data.decode()
assert review_comment in body