show next-steps modal when request is auto-approved

This commit is contained in:
dandds
2018-07-27 11:19:48 -04:00
parent 2befeea499
commit 94fb61682c
3 changed files with 91 additions and 1 deletions

View File

@@ -0,0 +1,49 @@
import pytest
from tests.mocks import MOCK_USER
ERROR_CLASS = "usa-input-error-message"
APPROVED_MOCK_REQUEST = {
"status": "approved"
}
@pytest.mark.gen_test
def test_submit_reviewed_request(monkeypatch, http_client, base_url):
monkeypatch.setattr(
"atst.handlers.request_submit.RequestsSubmit.get_current_user", lambda s: MOCK_USER
)
monkeypatch.setattr(
"atst.handlers.request_submit.RequestsSubmit.check_xsrf_cookie", lambda s: True
)
# this just needs to send a known invalid form value
response = yield http_client.fetch(
base_url + "/requests/submit/1",
method="POST",
headers={"Content-Type": "application/x-www-form-urlencoded"},
body="",
raise_error=False,
follow_redirects=False
)
assert response.headers["Location"] == "/requests"
@pytest.mark.gen_test
def test_submit_autoapproved_reviewed_request(monkeypatch, http_client, base_url):
monkeypatch.setattr(
"atst.handlers.request_submit.RequestsSubmit.get_current_user", lambda s: MOCK_USER
)
monkeypatch.setattr(
"atst.handlers.request_submit.RequestsSubmit.check_xsrf_cookie", lambda s: True
)
monkeypatch.setattr(
"tests.mocks.MOCK_REQUEST", APPROVED_MOCK_REQUEST
)
# this just needs to send a known invalid form value
response = yield http_client.fetch(
base_url + "/requests/submit/1",
method="POST",
headers={"Content-Type": "application/x-www-form-urlencoded"},
body="",
raise_error=False,
follow_redirects=False
)
assert response.headers["Location"] == "/requests?modal=True"