From 3415436f54591bdc3cfc34a299dcf629829e4dae Mon Sep 17 00:00:00 2001 From: dandds Date: Mon, 7 Jan 2019 10:02:13 -0500 Subject: [PATCH 1/7] toggle off requests workflow with config option --- atst/app.py | 6 +++++- atst/routes/__init__.py | 10 ++++++++-- config/base.ini | 1 + config/ci.ini | 1 + config/test.ini | 1 + templates/navigation/global_navigation.html | 18 ++++++++++-------- 6 files changed, 26 insertions(+), 11 deletions(-) diff --git a/atst/app.py b/atst/app.py index 444f7032..3ee0bd48 100644 --- a/atst/app.py +++ b/atst/app.py @@ -64,9 +64,12 @@ def make_app(config): make_error_pages(app) app.register_blueprint(bp) app.register_blueprint(workspace_routes) - app.register_blueprint(requests_bp) app.register_blueprint(task_orders_bp) app.register_blueprint(user_routes) + + if app.config.get("REQUESTS_WORKFLOW"): + app.register_blueprint(requests_bp) + if ENV != "prod": app.register_blueprint(dev_routes) @@ -131,6 +134,7 @@ def map_config(config): "REQUIRE_CRLS": config.getboolean("default", "REQUIRE_CRLS"), "RQ_REDIS_URL": config["default"]["REDIS_URI"], "RQ_QUEUES": [config["default"]["RQ_QUEUES"]], + "REQUESTS_WORKFLOW": config.getboolean("default", "REQUESTS_WORKFLOW"), } diff --git a/atst/routes/__init__.py b/atst/routes/__init__.py index 7581eed3..92a3831f 100644 --- a/atst/routes/__init__.py +++ b/atst/routes/__init__.py @@ -48,13 +48,19 @@ def helpdocs(doc=None): def home(): user = g.current_user + resource_index = ( + "requests.requests_index" + if app.config.get("REQUESTS_WORKFLOW") + else "workspaces.workspaces" + ) + if user.atat_role_name == "ccpo": - return redirect(url_for("requests.requests_index")) + return redirect(url_for(resource_index)) num_workspaces = len(user.workspace_roles) if num_workspaces == 0: - return redirect(url_for("requests.requests_index")) + return redirect(url_for(resource_index)) elif num_workspaces == 1: workspace_role = user.workspace_roles[0] workspace_id = workspace_role.workspace.id diff --git a/config/base.ini b/config/base.ini index ab075e1d..ad1f9dd9 100644 --- a/config/base.ini +++ b/config/base.ini @@ -25,3 +25,4 @@ SESSION_USE_SIGNER = True STORAGE_CONTAINER=uploads STORAGE_PROVIDER=LOCAL WTF_CSRF_ENABLED = true +REQUESTS_WORKFLOW=false diff --git a/config/ci.ini b/config/ci.ini index 3ee7f480..0c7e23fa 100644 --- a/config/ci.ini +++ b/config/ci.ini @@ -4,3 +4,4 @@ PGDATABASE = atat_test REDIS_URI = redis://redishost:6379 CRL_DIRECTORY = tests/fixtures/crl WTF_CSRF_ENABLED = false +REQUESTS_WORKFLOW=true diff --git a/config/test.ini b/config/test.ini index 3da77886..12639e91 100644 --- a/config/test.ini +++ b/config/test.ini @@ -4,3 +4,4 @@ PGDATABASE = atat_test CRL_DIRECTORY = tests/fixtures/crl WTF_CSRF_ENABLED = false STORAGE_PROVIDER=LOCAL +REQUESTS_WORKFLOW=true diff --git a/templates/navigation/global_navigation.html b/templates/navigation/global_navigation.html index a87c329d..04f9bb3a 100644 --- a/templates/navigation/global_navigation.html +++ b/templates/navigation/global_navigation.html @@ -2,14 +2,16 @@ From 08806eed246d36375c2ff7af0f9d49be2a02dcd2 Mon Sep 17 00:00:00 2001 From: dandds Date: Mon, 7 Jan 2019 16:03:40 -0500 Subject: [PATCH 3/7] put requests workflow tests behind a feature toggle --- config/ci.ini | 1 - config/test.ini | 1 - templates/about.html | 8 +++-- tests/conftest.py | 5 ++++ tests/domain/test_requests.py | 27 +++++++++++++++++ .../requests/requests_form/test_details.py | 3 ++ .../requests/requests_form/test_edit.py | 6 ++++ .../routes/requests/requests_form/test_new.py | 17 +++++++++++ .../requests/requests_form/test_submit.py | 2 ++ tests/routes/requests/test_approval.py | 14 +++++++++ .../requests/test_financial_verification.py | 29 +++++++++++++++++++ tests/routes/requests/test_requests_index.py | 3 ++ tests/routes/test_auth.py | 14 +++++---- tests/routes/test_errors.py | 3 +- tests/routes/test_home.py | 3 ++ tests/test_auth.py | 6 ++-- tests/test_integration.py | 1 + tests/test_routes.py | 19 ------------ 18 files changed, 129 insertions(+), 33 deletions(-) delete mode 100644 tests/test_routes.py diff --git a/config/ci.ini b/config/ci.ini index 0c7e23fa..3ee7f480 100644 --- a/config/ci.ini +++ b/config/ci.ini @@ -4,4 +4,3 @@ PGDATABASE = atat_test REDIS_URI = redis://redishost:6379 CRL_DIRECTORY = tests/fixtures/crl WTF_CSRF_ENABLED = false -REQUESTS_WORKFLOW=true diff --git a/config/test.ini b/config/test.ini index 12639e91..3da77886 100644 --- a/config/test.ini +++ b/config/test.ini @@ -4,4 +4,3 @@ PGDATABASE = atat_test CRL_DIRECTORY = tests/fixtures/crl WTF_CSRF_ENABLED = false STORAGE_PROVIDER=LOCAL -REQUESTS_WORKFLOW=true diff --git a/templates/about.html b/templates/about.html index 967afddd..7546ffdc 100644 --- a/templates/about.html +++ b/templates/about.html @@ -15,7 +15,9 @@ JEDI Cloud provides commercial Infrastructure as a Service (IaaS) and Platform as a Service (PaaS) offerings to support DoD business and mission operations.
Anyone with a DoD mission may use JEDI.

- New JEDI Request + {% if config.get("REQUESTS_WORKFLOW") %} + New JEDI Request + {% endif %}

Five Steps to the JEDI Cloud

@@ -27,7 +29,9 @@

Complete a JEDI Cloud Access Request

A JEDI Cloud Access Request will inform the the Cloud Computing Program Office (CCPO) about your intention to use JEDI's commercial cloud services and provide the preliminary information needed to grant access. - Any DoD employee with a CAC may initiate this request. Start a Request + {% if config.get("REQUESTS_WORKFLOW") %} + Any DoD employee with a CAC may initiate this request. Start a Request + {% endif %}

  • diff --git a/tests/conftest.py b/tests/conftest.py index c4e20d6d..8654a1d8 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -147,3 +147,8 @@ def extended_financial_verification_data(pdf_upload): def queue(): yield atst_queue atst_queue.get_queue().empty() + + +pytest.mark.requests_workflow = pytest.mark.skipif( + not make_config().get("REQUESTS_WORKFLOW"), reason="requests workflow is deprecated" +) diff --git a/tests/domain/test_requests.py b/tests/domain/test_requests.py index 4143d4fb..774979dd 100644 --- a/tests/domain/test_requests.py +++ b/tests/domain/test_requests.py @@ -21,6 +21,7 @@ def new_request(session): return RequestFactory.create() +@pytest.mark.requests_workflow def test_can_get_request(): factory_req = RequestFactory.create() request = Requests.get(factory_req.creator, factory_req.id) @@ -28,17 +29,20 @@ def test_can_get_request(): assert request.id == factory_req.id +@pytest.mark.requests_workflow def test_nonexistent_request_raises(): a_user = UserFactory.build() with pytest.raises(NotFoundError): Requests.get(a_user, uuid4()) +@pytest.mark.requests_workflow def test_new_request_has_started_status(): request = Requests.create(UserFactory.build(), {}) assert request.status == RequestStatus.STARTED +@pytest.mark.requests_workflow def test_auto_approve_less_than_1m(): new_request = RequestFactory.create(initial_revision={"dollar_value": 999_999}) request = Requests.submit(new_request) @@ -48,6 +52,7 @@ def test_auto_approve_less_than_1m(): assert request.reviews[0].full_name_reviewer == "System" +@pytest.mark.requests_workflow def test_dont_auto_approve_if_dollar_value_is_1m_or_above(): new_request = RequestFactory.create(initial_revision={"dollar_value": 1_000_000}) request = Requests.submit(new_request) @@ -55,6 +60,7 @@ def test_dont_auto_approve_if_dollar_value_is_1m_or_above(): assert request.status == RequestStatus.PENDING_CCPO_ACCEPTANCE +@pytest.mark.requests_workflow def test_dont_auto_approve_if_no_dollar_value_specified(): new_request = RequestFactory.create(initial_revision={}) request = Requests.submit(new_request) @@ -62,6 +68,7 @@ def test_dont_auto_approve_if_no_dollar_value_specified(): assert request.status == RequestStatus.PENDING_CCPO_ACCEPTANCE +@pytest.mark.requests_workflow def test_should_allow_submission(): new_request = RequestFactory.create() @@ -79,15 +86,18 @@ def test_should_allow_submission(): assert not Requests.should_allow_submission(new_request) +@pytest.mark.requests_workflow def test_request_knows_its_last_submission_timestamp(new_request): submitted_request = Requests.submit(new_request) assert submitted_request.last_submission_timestamp +@pytest.mark.requests_workflow def test_request_knows_if_it_has_no_last_submission_timestamp(new_request): assert new_request.last_submission_timestamp is None +@pytest.mark.requests_workflow def test_exists(session): user_allowed = UserFactory.create() user_denied = UserFactory.create() @@ -96,6 +106,7 @@ def test_exists(session): assert not Requests.exists(request.id, user_denied) +@pytest.mark.requests_workflow def test_status_count(session): # make sure table is empty session.query(Request).delete() @@ -114,6 +125,7 @@ def test_status_count(session): assert Requests.in_progress_count() == 2 +@pytest.mark.requests_workflow def test_status_count_scoped_to_creator(session): # make sure table is empty session.query(Request).delete() @@ -143,12 +155,14 @@ request_financial_data = { } +@pytest.mark.requests_workflow def test_set_status_sets_revision(): request = RequestFactory.create() Requests.set_status(request, RequestStatus.APPROVED) assert request.latest_revision == request.status_events[-1].revision +@pytest.mark.requests_workflow def test_advance_to_financial_verification(): request = RequestFactory.create_with_status( status=RequestStatus.PENDING_CCPO_ACCEPTANCE @@ -160,6 +174,7 @@ def test_advance_to_financial_verification(): assert current_review.fname_mao == review_data["fname_mao"] +@pytest.mark.requests_workflow def test_advance_to_approval(): request = RequestFactory.create_with_status( status=RequestStatus.PENDING_CCPO_APPROVAL @@ -169,6 +184,7 @@ def test_advance_to_approval(): assert request.status == RequestStatus.APPROVED +@pytest.mark.requests_workflow def test_request_changes_to_request_application(): request = RequestFactory.create_with_status( status=RequestStatus.PENDING_CCPO_ACCEPTANCE @@ -180,6 +196,7 @@ def test_request_changes_to_request_application(): assert current_review.fname_mao == review_data["fname_mao"] +@pytest.mark.requests_workflow def test_request_changes_to_financial_verification_info(): request = RequestFactory.create_with_status( status=RequestStatus.PENDING_CCPO_APPROVAL @@ -191,6 +208,7 @@ def test_request_changes_to_financial_verification_info(): assert current_review.fname_mao == review_data["fname_mao"] +@pytest.mark.requests_workflow def test_add_internal_comment(): request = RequestFactory.create() ccpo = UserFactory.from_atat_role("ccpo") @@ -203,6 +221,7 @@ def test_add_internal_comment(): assert request.internal_comments[0].text == "this is my comment" +@pytest.mark.requests_workflow def test_creator_can_view_own_request(): creator = UserFactory.create() request = RequestFactory.create(creator=creator) @@ -210,6 +229,7 @@ def test_creator_can_view_own_request(): assert RequestsAuthorization(creator, request).can_view +@pytest.mark.requests_workflow def test_ccpo_can_view_request(): ccpo = UserFactory.from_atat_role("ccpo") request = RequestFactory.create() @@ -217,6 +237,7 @@ def test_ccpo_can_view_request(): assert RequestsAuthorization(ccpo, request).can_view +@pytest.mark.requests_workflow def test_random_user_cannot_view_request(): user = UserFactory.create() request = RequestFactory.create() @@ -224,6 +245,7 @@ def test_random_user_cannot_view_request(): assert not RequestsAuthorization(user, request).can_view +@pytest.mark.requests_workflow def test_auto_approve_and_create_workspace(): request = RequestFactory.create() workspace = Requests.auto_approve_and_create_workspace(request) @@ -239,6 +261,7 @@ class TestStatusNotifications(object): assert job.func == queue._send_mail assert job.args[0] == [request.creator.email] + @pytest.mark.requests_workflow def test_pending_finver_triggers_notification(self, queue): request = RequestFactory.create() request = Requests.set_status(request, RequestStatus.PENDING_CCPO_ACCEPTANCE) @@ -247,12 +270,14 @@ class TestStatusNotifications(object): ) self._assert_job(queue, request) + @pytest.mark.requests_workflow def test_changes_requested_triggers_notification(self, queue): request = RequestFactory.create() request = Requests.set_status(request, RequestStatus.PENDING_CCPO_ACCEPTANCE) request = Requests.set_status(request, RequestStatus.CHANGES_REQUESTED) self._assert_job(queue, request) + @pytest.mark.requests_workflow def test_changes_requested_to_finver_triggers_notification(self, queue): request = RequestFactory.create() request = Requests.set_status(request, RequestStatus.PENDING_CCPO_APPROVAL) @@ -261,12 +286,14 @@ class TestStatusNotifications(object): ) self._assert_job(queue, request) + @pytest.mark.requests_workflow def test_approval_triggers_notification(self, queue): request = RequestFactory.create() request = Requests.set_status(request, RequestStatus.PENDING_CCPO_APPROVAL) request = Requests.set_status(request, RequestStatus.APPROVED) self._assert_job(queue, request) + @pytest.mark.requests_workflow def test_submitted_does_not_trigger_notification(self, queue): request = RequestFactory.create() request = Requests.set_status(request, RequestStatus.SUBMITTED) diff --git a/tests/routes/requests/requests_form/test_details.py b/tests/routes/requests/requests_form/test_details.py index ddeade54..27986112 100644 --- a/tests/routes/requests/requests_form/test_details.py +++ b/tests/routes/requests/requests_form/test_details.py @@ -1,3 +1,4 @@ +import pytest import re from flask import url_for @@ -6,6 +7,7 @@ from atst.models.request_status_event import RequestStatus from tests.factories import RequestFactory, LegacyTaskOrderFactory, UserFactory +@pytest.mark.requests_workflow def test_can_show_financial_data(client, user_session): user = UserFactory.create() user_session(user) @@ -24,6 +26,7 @@ def test_can_show_financial_data(client, user_session): assert re.search(r">\s+Financial Verification\s+<", body) +@pytest.mark.requests_workflow def test_can_not_show_financial_data(client, user_session): user = UserFactory.create() user_session(user) diff --git a/tests/routes/requests/requests_form/test_edit.py b/tests/routes/requests/requests_form/test_edit.py index 37e7b243..70fa8b9d 100644 --- a/tests/routes/requests/requests_form/test_edit.py +++ b/tests/routes/requests/requests_form/test_edit.py @@ -1,7 +1,9 @@ +import pytest from tests.factories import UserFactory, RequestFactory from atst.models.request_status_event import RequestStatus +@pytest.mark.requests_workflow def test_creator_pending_finver(client, user_session): request = RequestFactory.create_with_status( RequestStatus.PENDING_FINANCIAL_VERIFICATION @@ -13,6 +15,7 @@ def test_creator_pending_finver(client, user_session): assert "verify" in response.location +@pytest.mark.requests_workflow def test_creator_pending_finver_changes(client, user_session): request = RequestFactory.create_with_status( RequestStatus.CHANGES_REQUESTED_TO_FINVER @@ -24,6 +27,7 @@ def test_creator_pending_finver_changes(client, user_session): assert "verify" in response.location +@pytest.mark.requests_workflow def test_creator_approved(client, user_session): request = RequestFactory.create_with_status(RequestStatus.APPROVED) user_session(request.creator) @@ -33,6 +37,7 @@ def test_creator_approved(client, user_session): assert "details" in response.location +@pytest.mark.requests_workflow def test_creator_approved(client, user_session): request = RequestFactory.create_with_status(RequestStatus.STARTED) user_session(request.creator) @@ -42,6 +47,7 @@ def test_creator_approved(client, user_session): assert "new" in response.location +@pytest.mark.requests_workflow def test_ccpo(client, user_session): ccpo = UserFactory.from_atat_role("ccpo") request = RequestFactory.create_with_status(RequestStatus.STARTED) diff --git a/tests/routes/requests/requests_form/test_new.py b/tests/routes/requests/requests_form/test_new.py index 81d195a8..ce55fc27 100644 --- a/tests/routes/requests/requests_form/test_new.py +++ b/tests/routes/requests/requests_form/test_new.py @@ -1,3 +1,4 @@ +import pytest import datetime import re from tests.factories import ( @@ -17,6 +18,7 @@ from tests.assert_util import dict_contains ERROR_CLASS = "alert--error" +@pytest.mark.requests_workflow def test_submit_invalid_request_form(monkeypatch, client, user_session): user_session() response = client.post( @@ -27,6 +29,7 @@ def test_submit_invalid_request_form(monkeypatch, client, user_session): assert re.search(ERROR_CLASS, response.data.decode()) +@pytest.mark.requests_workflow def test_submit_valid_request_form(monkeypatch, client, user_session): user_session() monkeypatch.setattr( @@ -41,6 +44,7 @@ def test_submit_valid_request_form(monkeypatch, client, user_session): assert "/requests/new/2" in response.headers.get("Location") +@pytest.mark.requests_workflow def test_owner_can_view_request(client, user_session): user = UserFactory.create() user_session(user) @@ -53,6 +57,7 @@ def test_owner_can_view_request(client, user_session): assert response.status_code == 200 +@pytest.mark.requests_workflow def test_non_owner_cannot_view_request(client, user_session): user = UserFactory.create() user_session(user) @@ -65,6 +70,7 @@ def test_non_owner_cannot_view_request(client, user_session): assert response.status_code == 404 +@pytest.mark.requests_workflow def test_ccpo_can_view_request(client, user_session): ccpo = Roles.get("ccpo") user = UserFactory.create(atat_role=ccpo) @@ -78,6 +84,7 @@ def test_ccpo_can_view_request(client, user_session): assert response.status_code == 200 +@pytest.mark.requests_workflow def test_nonexistent_request(client, user_session): user_session() response = client.get("/requests/new/1/foo", follow_redirects=True) @@ -85,6 +92,7 @@ def test_nonexistent_request(client, user_session): assert response.status_code == 404 +@pytest.mark.requests_workflow def test_creator_info_is_autopopulated_for_existing_request( monkeypatch, client, user_session ): @@ -108,6 +116,7 @@ def test_creator_info_is_autopopulated_for_existing_request( assert "initial-value='{}'".format(value) in body +@pytest.mark.requests_workflow def test_creator_info_is_autopopulated_for_new_request( monkeypatch, client, user_session ): @@ -121,6 +130,7 @@ def test_creator_info_is_autopopulated_for_new_request( assert "initial-value='{}'".format(user.email) in body +@pytest.mark.requests_workflow def test_non_creator_info_is_not_autopopulated(monkeypatch, client, user_session): user = UserFactory.create() creator = UserFactory.create() @@ -134,6 +144,7 @@ def test_non_creator_info_is_not_autopopulated(monkeypatch, client, user_session assert not user.email in body +@pytest.mark.requests_workflow def test_am_poc_causes_poc_to_be_autopopulated(client, user_session): creator = UserFactory.create() user_session(creator) @@ -147,6 +158,7 @@ def test_am_poc_causes_poc_to_be_autopopulated(client, user_session): assert request.body["primary_poc"]["dodid_poc"] == creator.dod_id +@pytest.mark.requests_workflow def test_not_am_poc_requires_poc_info_to_be_completed(client, user_session): creator = UserFactory.create() user_session(creator) @@ -160,6 +172,7 @@ def test_not_am_poc_requires_poc_info_to_be_completed(client, user_session): assert ERROR_CLASS in response.data.decode() +@pytest.mark.requests_workflow def test_not_am_poc_allows_user_to_fill_in_poc_info(client, user_session): creator = UserFactory.create() user_session(creator) @@ -179,6 +192,7 @@ def test_not_am_poc_allows_user_to_fill_in_poc_info(client, user_session): assert ERROR_CLASS not in response.data.decode() +@pytest.mark.requests_workflow def test_poc_details_can_be_autopopulated_on_new_request(client, user_session): creator = UserFactory.create() user_session(creator) @@ -193,6 +207,7 @@ def test_poc_details_can_be_autopopulated_on_new_request(client, user_session): assert request.body["primary_poc"]["dodid_poc"] == creator.dod_id +@pytest.mark.requests_workflow def test_poc_autofill_checks_information_about_you_form_first(client, user_session): creator = UserFactory.create() user_session(creator) @@ -221,6 +236,7 @@ def test_poc_autofill_checks_information_about_you_form_first(client, user_sessi ) +@pytest.mark.requests_workflow def test_can_review_data(user_session, client): creator = UserFactory.create() user_session(creator) @@ -232,6 +248,7 @@ def test_can_review_data(user_session, client): assert request.body["information_about_you"]["email_request"] in body +@pytest.mark.requests_workflow def test_displays_ccpo_review_comment(user_session, client): creator = UserFactory.create() ccpo = UserFactory.from_atat_role("ccpo") diff --git a/tests/routes/requests/requests_form/test_submit.py b/tests/routes/requests/requests_form/test_submit.py index f5f9c1d8..a214a355 100644 --- a/tests/routes/requests/requests_form/test_submit.py +++ b/tests/routes/requests/requests_form/test_submit.py @@ -8,6 +8,7 @@ def _mock_func(*args, **kwargs): return RequestFactory.create() +@pytest.mark.requests_workflow def test_submit_reviewed_request(monkeypatch, client, user_session): user_session() monkeypatch.setattr("atst.domain.requests.Requests.get", _mock_func) @@ -24,6 +25,7 @@ def test_submit_reviewed_request(monkeypatch, client, user_session): assert "modal=pendingCCPOAcceptance" in response.headers["Location"] +@pytest.mark.requests_workflow def test_submit_autoapproved_reviewed_request(monkeypatch, client, user_session): user_session() monkeypatch.setattr("atst.domain.requests.Requests.get", _mock_func) diff --git a/tests/routes/requests/test_approval.py b/tests/routes/requests/test_approval.py index 9d507789..ba2fe6a5 100644 --- a/tests/routes/requests/test_approval.py +++ b/tests/routes/requests/test_approval.py @@ -1,3 +1,4 @@ +import pytest import os from flask import url_for @@ -14,6 +15,7 @@ from tests.factories import ( ) +@pytest.mark.requests_workflow def test_ccpo_can_view_approval(user_session, client): ccpo = Roles.get("ccpo") user = UserFactory.create(atat_role=ccpo) @@ -24,6 +26,7 @@ def test_ccpo_can_view_approval(user_session, client): assert response.status_code == 200 +@pytest.mark.requests_workflow def test_ccpo_prepopulated_as_mission_owner(user_session, client): user = UserFactory.from_atat_role("ccpo") user_session(user) @@ -36,6 +39,7 @@ def test_ccpo_prepopulated_as_mission_owner(user_session, client): assert user.last_name in body +@pytest.mark.requests_workflow def test_non_ccpo_cannot_view_approval(user_session, client): user = UserFactory.create() user_session(user) @@ -45,6 +49,7 @@ def test_non_ccpo_cannot_view_approval(user_session, client): assert response.status_code == 404 +@pytest.mark.requests_workflow def prepare_request_pending_approval(creator, pdf_attachment=None): legacy_task_order = LegacyTaskOrderFactory.create( number="abc123", pdf=pdf_attachment @@ -56,6 +61,7 @@ def prepare_request_pending_approval(creator, pdf_attachment=None): ) +@pytest.mark.requests_workflow def test_ccpo_sees_pdf_link(user_session, client, pdf_upload): ccpo = UserFactory.from_atat_role("ccpo") user_session(ccpo) @@ -70,6 +76,7 @@ def test_ccpo_sees_pdf_link(user_session, client, pdf_upload): assert download_url in body +@pytest.mark.requests_workflow def test_ccpo_does_not_see_pdf_link_if_no_pdf(user_session, client, pdf_upload): ccpo = UserFactory.from_atat_role("ccpo") user_session(ccpo) @@ -83,6 +90,7 @@ def test_ccpo_does_not_see_pdf_link_if_no_pdf(user_session, client, pdf_upload): assert download_url not in body +@pytest.mark.requests_workflow def test_task_order_download(app, client, user_session, pdf_upload): user = UserFactory.create() user_session(user) @@ -108,6 +116,7 @@ def test_task_order_download(app, client, user_session, pdf_upload): assert response.data == pdf_content +@pytest.mark.requests_workflow def test_task_order_download_does_not_exist(client, user_session): user = UserFactory.create() user_session(user) @@ -118,6 +127,7 @@ def test_task_order_download_does_not_exist(client, user_session): assert response.status_code == 404 +@pytest.mark.requests_workflow def test_can_submit_request_approval(client, user_session): user = UserFactory.from_atat_role("ccpo") user_session(user) @@ -133,6 +143,7 @@ def test_can_submit_request_approval(client, user_session): assert request.status == RequestStatus.PENDING_FINANCIAL_VERIFICATION +@pytest.mark.requests_workflow def test_can_submit_request_denial(client, user_session): user = UserFactory.from_atat_role("ccpo") user_session(user) @@ -148,6 +159,7 @@ def test_can_submit_request_denial(client, user_session): assert request.status == RequestStatus.CHANGES_REQUESTED +@pytest.mark.requests_workflow def test_ccpo_user_can_comment_on_request(client, user_session): user = UserFactory.from_atat_role("ccpo") user_session(user) @@ -167,6 +179,7 @@ def test_ccpo_user_can_comment_on_request(client, user_session): assert request.internal_comments[0].text == comment_text +@pytest.mark.requests_workflow def test_comment_text_is_required(client, user_session): user = UserFactory.from_atat_role("ccpo") user_session(user) @@ -184,6 +197,7 @@ def test_comment_text_is_required(client, user_session): assert len(request.internal_comments) == 0 +@pytest.mark.requests_workflow def test_other_user_cannot_comment_on_request(client, user_session): user = UserFactory.create() user_session(user) diff --git a/tests/routes/requests/test_financial_verification.py b/tests/routes/requests/test_financial_verification.py index 734d0864..f7ab9d77 100644 --- a/tests/routes/requests/test_financial_verification.py +++ b/tests/routes/requests/test_financial_verification.py @@ -69,6 +69,7 @@ FalseValidator = MagicMock() FalseValidator.validate = MagicMock(return_value=False) +@pytest.mark.requests_workflow def test_update_fv(fv_data): request = RequestFactory.create() user = UserFactory.create() @@ -81,6 +82,7 @@ def test_update_fv(fv_data): assert updated_request.is_pending_ccpo_approval +@pytest.mark.requests_workflow def test_update_fv_re_enter_pe_number(fv_data): request = RequestFactory.create() user = UserFactory.create() @@ -96,6 +98,7 @@ def test_update_fv_re_enter_pe_number(fv_data): assert updated_request.is_pending_ccpo_approval +@pytest.mark.requests_workflow def test_update_fv_invalid_task_order_number(fv_data): request = RequestFactory.create() user = UserFactory.create() @@ -113,6 +116,7 @@ def test_update_fv_invalid_task_order_number(fv_data): update_fv.execute() +@pytest.mark.requests_workflow def test_draft_without_pe_id(fv_data): request = RequestFactory.create() user = UserFactory.create() @@ -127,6 +131,7 @@ def test_draft_without_pe_id(fv_data): ).execute() +@pytest.mark.requests_workflow def test_update_fv_extended(fv_data, e_fv_data): request = RequestFactory.create() user = UserFactory.create() @@ -138,6 +143,7 @@ def test_update_fv_extended(fv_data, e_fv_data): assert update_fv.execute() +@pytest.mark.requests_workflow def test_update_fv_extended_does_not_validate_task_order(fv_data, e_fv_data): request = RequestFactory.create() user = UserFactory.create() @@ -149,6 +155,7 @@ def test_update_fv_extended_does_not_validate_task_order(fv_data, e_fv_data): assert update_fv.execute() +@pytest.mark.requests_workflow def test_update_fv_missing_extended_data(fv_data): request = RequestFactory.create() user = UserFactory.create() @@ -165,6 +172,7 @@ def test_update_fv_missing_extended_data(fv_data): update_fv.execute() +@pytest.mark.requests_workflow def test_update_fv_submission(fv_data): request = RequestFactory.create() user = UserFactory.create() @@ -174,6 +182,7 @@ def test_update_fv_submission(fv_data): assert updated_request +@pytest.mark.requests_workflow def test_save_empty_draft(): request = RequestFactory.create() user = UserFactory.create() @@ -184,6 +193,7 @@ def test_save_empty_draft(): assert save_draft.execute() +@pytest.mark.requests_workflow def test_save_draft_with_ba_code(): request = RequestFactory.create() user = UserFactory.create() @@ -195,6 +205,7 @@ def test_save_draft_with_ba_code(): assert save_draft.execute() +@pytest.mark.requests_workflow def test_save_draft_allows_invalid_data(): request = RequestFactory.create() user = UserFactory.create() @@ -214,6 +225,7 @@ def test_save_draft_allows_invalid_data(): ).execute() +@pytest.mark.requests_workflow def test_save_draft_and_then_submit(): request = RequestFactory.create() user = UserFactory.create() @@ -228,6 +240,7 @@ def test_save_draft_and_then_submit(): ).execute() +@pytest.mark.requests_workflow def test_updated_request_has_pdf(fv_data, e_fv_data): request = RequestFactory.create() user = UserFactory.create() @@ -238,6 +251,7 @@ def test_updated_request_has_pdf(fv_data, e_fv_data): assert updated_request.legacy_task_order.pdf +@pytest.mark.requests_workflow def test_can_save_draft_with_just_pdf(e_fv_data): request = RequestFactory.create() user = UserFactory.create() @@ -250,6 +264,7 @@ def test_can_save_draft_with_just_pdf(e_fv_data): assert form.legacy_task_order.pdf +@pytest.mark.requests_workflow def test_task_order_info_present_in_extended_form(fv_data, e_fv_data): request = RequestFactory.create() user = UserFactory.create() @@ -265,6 +280,7 @@ def test_task_order_info_present_in_extended_form(fv_data, e_fv_data): assert form.legacy_task_order.clin_0001.data +@pytest.mark.requests_workflow def test_update_ignores_empty_values(fv_data, e_fv_data): request = RequestFactory.create() user = UserFactory.create() @@ -274,6 +290,7 @@ def test_update_ignores_empty_values(fv_data, e_fv_data): ).execute() +@pytest.mark.requests_workflow def test_can_save_draft_with_funding_type(fv_data, e_fv_data): request = RequestFactory.create() user = UserFactory.create() @@ -288,6 +305,7 @@ def test_can_save_draft_with_funding_type(fv_data, e_fv_data): assert updated_request.legacy_task_order.funding_type +@pytest.mark.requests_workflow def test_update_fv_route(client, user_session, fv_data): user = UserFactory.create() request = RequestFactory.create(creator=user) @@ -301,6 +319,7 @@ def test_update_fv_route(client, user_session, fv_data): assert response.status_code == 200 +@pytest.mark.requests_workflow def test_save_fv_draft_route(client, user_session, fv_data): user = UserFactory.create() request = RequestFactory.create(creator=user) @@ -314,6 +333,7 @@ def test_save_fv_draft_route(client, user_session, fv_data): assert response.status_code == 200 +@pytest.mark.requests_workflow def test_get_fv_form_route(client, user_session, fv_data): user = UserFactory.create() request = RequestFactory.create(creator=user) @@ -327,6 +347,7 @@ def test_get_fv_form_route(client, user_session, fv_data): assert response.status_code == 200 +@pytest.mark.requests_workflow def test_manual_task_order_triggers_extended_form( client, user_session, fv_data, e_fv_data ): @@ -348,6 +369,7 @@ def test_manual_task_order_triggers_extended_form( assert "extended" in response.headers["Location"] +@pytest.mark.requests_workflow def test_manual_to_does_not_trigger_approval(client, user_session, fv_data, e_fv_data): user = UserFactory.create() request = RequestFactory.create(creator=user) @@ -370,6 +392,7 @@ def test_manual_to_does_not_trigger_approval(client, user_session, fv_data, e_fv assert updated_request.status != RequestStatus.APPROVED +@pytest.mark.requests_workflow def test_eda_task_order_does_trigger_approval(client, user_session, fv_data, e_fv_data): user = UserFactory.create() request = RequestFactory.create(creator=user) @@ -392,6 +415,7 @@ def test_eda_task_order_does_trigger_approval(client, user_session, fv_data, e_f assert updated_request.status == RequestStatus.APPROVED +@pytest.mark.requests_workflow def test_attachment_on_non_extended_form(client, user_session, fv_data, e_fv_data): user = UserFactory.create() request = RequestFactory.create(creator=user) @@ -417,6 +441,7 @@ def test_attachment_on_non_extended_form(client, user_session, fv_data, e_fv_dat assert response.status_code == 200 +@pytest.mark.requests_workflow def test_task_order_number_persists_in_form(fv_data, e_fv_data): user = UserFactory.create() request = RequestFactory.create(creator=user) @@ -437,6 +462,7 @@ def test_task_order_number_persists_in_form(fv_data, e_fv_data): assert form.legacy_task_order.number.data == MANUAL_TO_NUMBER +@pytest.mark.requests_workflow def test_can_submit_once_to_details_are_entered(fv_data, e_fv_data): user = UserFactory.create() request = RequestFactory.create(creator=user) @@ -464,6 +490,7 @@ def test_can_submit_once_to_details_are_entered(fv_data, e_fv_data): ).execute() +@pytest.mark.requests_workflow def test_existing_task_order_with_pdf(fv_data, e_fv_data, client, user_session): # Use finver route to create initial TO #1, complete with PDF user = UserFactory.create() @@ -496,6 +523,7 @@ def test_existing_task_order_with_pdf(fv_data, e_fv_data, client, user_session): assert response.status_code == 200 +@pytest.mark.requests_workflow def test_pdf_clearing(fv_data, e_fv_data, pdf_upload, pdf_upload2): user = UserFactory.create() request = RequestFactory.create(creator=user) @@ -521,6 +549,7 @@ def test_pdf_clearing(fv_data, e_fv_data, pdf_upload, pdf_upload2): # in the related attachment entity. I have changed the handling in # FinancialVerificationBase#_get_form to be more generous in how it finds the # PDF filename and prepopulates the form data with that name. +@pytest.mark.requests_workflow def test_always_derives_pdf_filename(fv_data, e_fv_data, pdf_upload): user = UserFactory.create() request_one = RequestFactory.create(creator=user) diff --git a/tests/routes/requests/test_requests_index.py b/tests/routes/requests/test_requests_index.py index a5ce31c3..021e81bf 100644 --- a/tests/routes/requests/test_requests_index.py +++ b/tests/routes/requests/test_requests_index.py @@ -1,3 +1,4 @@ +import pytest from flask import url_for from atst.routes.requests.index import RequestsIndex @@ -5,6 +6,7 @@ from tests.factories import RequestFactory, UserFactory from atst.domain.requests import Requests +@pytest.mark.requests_workflow def test_action_required_mission_owner(): creator = UserFactory.create() requests = RequestFactory.create_batch(5, creator=creator) @@ -16,6 +18,7 @@ def test_action_required_mission_owner(): assert context["requests"][0]["action_required"] == False +@pytest.mark.requests_workflow def test_action_required_ccpo(): creator = UserFactory.create() requests = RequestFactory.create_batch(5, creator=creator) diff --git a/tests/routes/test_auth.py b/tests/routes/test_auth.py index aef34fbd..a0389929 100644 --- a/tests/routes/test_auth.py +++ b/tests/routes/test_auth.py @@ -4,20 +4,22 @@ from urllib.parse import quote from tests.factories import UserFactory +PROTECTED_URL = "/workspaces" + + def test_request_page_with_complete_profile(client, user_session): user = UserFactory.create() user_session(user) - response = client.get("/requests", follow_redirects=False) + response = client.get(PROTECTED_URL, follow_redirects=False) assert response.status_code == 200 def test_redirect_when_profile_missing_fields(client, user_session): user = UserFactory.create(date_latest_training=None) user_session(user) - requested_url = "/requests" - response = client.get(requested_url, follow_redirects=False) + response = client.get(PROTECTED_URL, follow_redirects=False) assert response.status_code == 302 - assert "/user?next={}".format(quote(requested_url, safe="")) in response.location + assert "/user?next={}".format(quote(PROTECTED_URL, safe="")) in response.location def test_unprotected_route_with_incomplete_profile(client, user_session): @@ -30,7 +32,7 @@ def test_unprotected_route_with_incomplete_profile(client, user_session): def test_completing_user_profile(client, user_session): user = UserFactory.create(phone_number=None) user_session(user) - response = client.get("/requests", follow_redirects=True) + response = client.get(PROTECTED_URL, follow_redirects=True) assert b"You must complete your profile" in response.data updated_data = {**user.to_dictionary(), "phone_number": "5558675309"} @@ -40,6 +42,6 @@ def test_completing_user_profile(client, user_session): response = client.post(url_for("users.update_user"), data=updated_data) assert response.status_code == 200 - response = client.get("/requests", follow_redirects=False) + response = client.get(PROTECTED_URL, follow_redirects=False) assert response.status_code == 200 assert b"You must complete your profile" not in response.data diff --git a/tests/routes/test_errors.py b/tests/routes/test_errors.py index 2ab85918..35c0d82d 100644 --- a/tests/routes/test_errors.py +++ b/tests/routes/test_errors.py @@ -1,4 +1,5 @@ import pytest +from flask import url_for @pytest.fixture @@ -10,7 +11,7 @@ def csrf_enabled_app(app): def test_csrf_error(csrf_enabled_app, client): response = client.post( - "/requests/new/1", + url_for("users.user"), headers={"Content-Type": "application/x-www-form-urlencoded"}, data="csrf_token=invalid_token", follow_redirects=True, diff --git a/tests/routes/test_home.py b/tests/routes/test_home.py index 082efca6..c95cb25d 100644 --- a/tests/routes/test_home.py +++ b/tests/routes/test_home.py @@ -19,6 +19,7 @@ def test_user_without_workspaces_has_no_workspaces_nav(client, user_session): assert b'href="/workspaces"' not in response.data +@pytest.mark.skip(reason="this may no longer be accurate") def test_request_owner_with_no_workspaces_redirected_to_requests(client, user_session): request = RequestFactory.create() user_session(request.creator) @@ -50,6 +51,7 @@ def test_request_owner_with_more_than_one_workspace_redirected_to_workspaces( assert "/workspaces" in response.location +@pytest.mark.skip(reason="this may no longer be accurate") def test_non_owner_user_with_no_workspaces_redirected_to_requests(client, user_session): user = UserFactory.create() @@ -86,6 +88,7 @@ def test_non_owner_user_with_mulitple_workspaces_redirected_to_workspaces( assert "/workspaces" in response.location +@pytest.mark.skip(reason="this may no longer be accurate") def test_ccpo_user_redirected_to_requests(client, user_session): user = UserFactory.from_atat_role("ccpo") for _ in range(3): diff --git a/tests/test_auth.py b/tests/test_auth.py index 099dc4ec..129b3205 100644 --- a/tests/test_auth.py +++ b/tests/test_auth.py @@ -189,11 +189,11 @@ def test_logout(app, client, monkeypatch): ) # create a real session resp = _login(client) - resp_success = client.get(url_for("requests.requests_index")) + resp_success = client.get(url_for("users.user")) # verify session is valid assert resp_success.status_code == 200 client.get(url_for("atst.logout")) - resp_failure = client.get(url_for("requests.requests_index")) + resp_failure = client.get(url_for("users.user")) # verify that logging out has cleared the session assert resp_failure.status_code == 302 destination = urlparse(resp_failure.headers["Location"]).path @@ -208,6 +208,6 @@ def test_redirected_on_login(client, monkeypatch): "atst.domain.authnid.AuthenticationContext.get_user", lambda *args: UserFactory.create(), ) - target_route = url_for("requests.requests_form_new", screen=1) + target_route = url_for("users.user") response = _login(client, next=target_route) assert target_route in response.headers.get("Location") diff --git a/tests/test_integration.py b/tests/test_integration.py index 152e960b..aa22eb50 100644 --- a/tests/test_integration.py +++ b/tests/test_integration.py @@ -26,6 +26,7 @@ def serialize_dates(data): return new_data +@pytest.mark.requests_workflow def test_stepthrough_request_form(user_session, screens, client): user = UserFactory.create() user_session(user) diff --git a/tests/test_routes.py b/tests/test_routes.py deleted file mode 100644 index b1c03a4a..00000000 --- a/tests/test_routes.py +++ /dev/null @@ -1,19 +0,0 @@ -import pytest - - -@pytest.mark.parametrize( - "path", - ( - "/workspaces", - "/requests", - "/requests/new/1", - "/users", - "/reports", - "/calculator", - ), -) -def test_routes(path, client, user_session): - user_session() - - response = client.get(path) - assert response.status_code == 200 From c2a597d98bd403131d84f2a5cdb3127c5d14e3d1 Mon Sep 17 00:00:00 2001 From: Montana Date: Wed, 9 Jan 2019 13:22:32 -0500 Subject: [PATCH 4/7] hide requests --- atst/app.py | 5 +---- atst/routes/__init__.py | 10 ++-------- config/base.ini | 1 - templates/about.html | 6 ------ templates/navigation/global_navigation.html | 11 ----------- templates/navigation/topbar.html | 6 ------ 6 files changed, 3 insertions(+), 36 deletions(-) diff --git a/atst/app.py b/atst/app.py index 3ee0bd48..a1c5d1d4 100644 --- a/atst/app.py +++ b/atst/app.py @@ -66,9 +66,7 @@ def make_app(config): app.register_blueprint(workspace_routes) app.register_blueprint(task_orders_bp) app.register_blueprint(user_routes) - - if app.config.get("REQUESTS_WORKFLOW"): - app.register_blueprint(requests_bp) + app.register_blueprint(requests_bp) if ENV != "prod": app.register_blueprint(dev_routes) @@ -134,7 +132,6 @@ def map_config(config): "REQUIRE_CRLS": config.getboolean("default", "REQUIRE_CRLS"), "RQ_REDIS_URL": config["default"]["REDIS_URI"], "RQ_QUEUES": [config["default"]["RQ_QUEUES"]], - "REQUESTS_WORKFLOW": config.getboolean("default", "REQUESTS_WORKFLOW"), } diff --git a/atst/routes/__init__.py b/atst/routes/__init__.py index 92a3831f..7581eed3 100644 --- a/atst/routes/__init__.py +++ b/atst/routes/__init__.py @@ -48,19 +48,13 @@ def helpdocs(doc=None): def home(): user = g.current_user - resource_index = ( - "requests.requests_index" - if app.config.get("REQUESTS_WORKFLOW") - else "workspaces.workspaces" - ) - if user.atat_role_name == "ccpo": - return redirect(url_for(resource_index)) + return redirect(url_for("requests.requests_index")) num_workspaces = len(user.workspace_roles) if num_workspaces == 0: - return redirect(url_for(resource_index)) + return redirect(url_for("requests.requests_index")) elif num_workspaces == 1: workspace_role = user.workspace_roles[0] workspace_id = workspace_role.workspace.id diff --git a/config/base.ini b/config/base.ini index ad1f9dd9..ab075e1d 100644 --- a/config/base.ini +++ b/config/base.ini @@ -25,4 +25,3 @@ SESSION_USE_SIGNER = True STORAGE_CONTAINER=uploads STORAGE_PROVIDER=LOCAL WTF_CSRF_ENABLED = true -REQUESTS_WORKFLOW=false diff --git a/templates/about.html b/templates/about.html index 7546ffdc..083d9cc1 100644 --- a/templates/about.html +++ b/templates/about.html @@ -15,9 +15,6 @@ JEDI Cloud provides commercial Infrastructure as a Service (IaaS) and Platform as a Service (PaaS) offerings to support DoD business and mission operations.
    Anyone with a DoD mission may use JEDI.

    - {% if config.get("REQUESTS_WORKFLOW") %} - New JEDI Request - {% endif %}

    Five Steps to the JEDI Cloud

    @@ -29,9 +26,6 @@

    Complete a JEDI Cloud Access Request

    A JEDI Cloud Access Request will inform the the Cloud Computing Program Office (CCPO) about your intention to use JEDI's commercial cloud services and provide the preliminary information needed to grant access. - {% if config.get("REQUESTS_WORKFLOW") %} - Any DoD employee with a CAC may initiate this request. Start a Request - {% endif %}

  • diff --git a/templates/navigation/global_navigation.html b/templates/navigation/global_navigation.html index 04f9bb3a..c0c43cf2 100644 --- a/templates/navigation/global_navigation.html +++ b/templates/navigation/global_navigation.html @@ -2,17 +2,6 @@ From aea690cb0fc59b0a6b0b43ebbaee945650e638cf Mon Sep 17 00:00:00 2001 From: Montana Date: Wed, 9 Jan 2019 13:40:03 -0500 Subject: [PATCH 5/7] Keep test coverage, but skip front end tests for requests --- tests/conftest.py | 5 ---- tests/domain/test_requests.py | 27 ----------------- .../requests/requests_form/test_details.py | 3 -- .../requests/requests_form/test_edit.py | 6 ---- .../routes/requests/requests_form/test_new.py | 17 ----------- .../requests/requests_form/test_submit.py | 2 -- tests/routes/requests/test_approval.py | 14 --------- .../requests/test_financial_verification.py | 29 ------------------- tests/routes/requests/test_requests_index.py | 3 -- tests/test_integration.py | 1 - 10 files changed, 107 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 8654a1d8..c4e20d6d 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -147,8 +147,3 @@ def extended_financial_verification_data(pdf_upload): def queue(): yield atst_queue atst_queue.get_queue().empty() - - -pytest.mark.requests_workflow = pytest.mark.skipif( - not make_config().get("REQUESTS_WORKFLOW"), reason="requests workflow is deprecated" -) diff --git a/tests/domain/test_requests.py b/tests/domain/test_requests.py index 774979dd..4143d4fb 100644 --- a/tests/domain/test_requests.py +++ b/tests/domain/test_requests.py @@ -21,7 +21,6 @@ def new_request(session): return RequestFactory.create() -@pytest.mark.requests_workflow def test_can_get_request(): factory_req = RequestFactory.create() request = Requests.get(factory_req.creator, factory_req.id) @@ -29,20 +28,17 @@ def test_can_get_request(): assert request.id == factory_req.id -@pytest.mark.requests_workflow def test_nonexistent_request_raises(): a_user = UserFactory.build() with pytest.raises(NotFoundError): Requests.get(a_user, uuid4()) -@pytest.mark.requests_workflow def test_new_request_has_started_status(): request = Requests.create(UserFactory.build(), {}) assert request.status == RequestStatus.STARTED -@pytest.mark.requests_workflow def test_auto_approve_less_than_1m(): new_request = RequestFactory.create(initial_revision={"dollar_value": 999_999}) request = Requests.submit(new_request) @@ -52,7 +48,6 @@ def test_auto_approve_less_than_1m(): assert request.reviews[0].full_name_reviewer == "System" -@pytest.mark.requests_workflow def test_dont_auto_approve_if_dollar_value_is_1m_or_above(): new_request = RequestFactory.create(initial_revision={"dollar_value": 1_000_000}) request = Requests.submit(new_request) @@ -60,7 +55,6 @@ def test_dont_auto_approve_if_dollar_value_is_1m_or_above(): assert request.status == RequestStatus.PENDING_CCPO_ACCEPTANCE -@pytest.mark.requests_workflow def test_dont_auto_approve_if_no_dollar_value_specified(): new_request = RequestFactory.create(initial_revision={}) request = Requests.submit(new_request) @@ -68,7 +62,6 @@ def test_dont_auto_approve_if_no_dollar_value_specified(): assert request.status == RequestStatus.PENDING_CCPO_ACCEPTANCE -@pytest.mark.requests_workflow def test_should_allow_submission(): new_request = RequestFactory.create() @@ -86,18 +79,15 @@ def test_should_allow_submission(): assert not Requests.should_allow_submission(new_request) -@pytest.mark.requests_workflow def test_request_knows_its_last_submission_timestamp(new_request): submitted_request = Requests.submit(new_request) assert submitted_request.last_submission_timestamp -@pytest.mark.requests_workflow def test_request_knows_if_it_has_no_last_submission_timestamp(new_request): assert new_request.last_submission_timestamp is None -@pytest.mark.requests_workflow def test_exists(session): user_allowed = UserFactory.create() user_denied = UserFactory.create() @@ -106,7 +96,6 @@ def test_exists(session): assert not Requests.exists(request.id, user_denied) -@pytest.mark.requests_workflow def test_status_count(session): # make sure table is empty session.query(Request).delete() @@ -125,7 +114,6 @@ def test_status_count(session): assert Requests.in_progress_count() == 2 -@pytest.mark.requests_workflow def test_status_count_scoped_to_creator(session): # make sure table is empty session.query(Request).delete() @@ -155,14 +143,12 @@ request_financial_data = { } -@pytest.mark.requests_workflow def test_set_status_sets_revision(): request = RequestFactory.create() Requests.set_status(request, RequestStatus.APPROVED) assert request.latest_revision == request.status_events[-1].revision -@pytest.mark.requests_workflow def test_advance_to_financial_verification(): request = RequestFactory.create_with_status( status=RequestStatus.PENDING_CCPO_ACCEPTANCE @@ -174,7 +160,6 @@ def test_advance_to_financial_verification(): assert current_review.fname_mao == review_data["fname_mao"] -@pytest.mark.requests_workflow def test_advance_to_approval(): request = RequestFactory.create_with_status( status=RequestStatus.PENDING_CCPO_APPROVAL @@ -184,7 +169,6 @@ def test_advance_to_approval(): assert request.status == RequestStatus.APPROVED -@pytest.mark.requests_workflow def test_request_changes_to_request_application(): request = RequestFactory.create_with_status( status=RequestStatus.PENDING_CCPO_ACCEPTANCE @@ -196,7 +180,6 @@ def test_request_changes_to_request_application(): assert current_review.fname_mao == review_data["fname_mao"] -@pytest.mark.requests_workflow def test_request_changes_to_financial_verification_info(): request = RequestFactory.create_with_status( status=RequestStatus.PENDING_CCPO_APPROVAL @@ -208,7 +191,6 @@ def test_request_changes_to_financial_verification_info(): assert current_review.fname_mao == review_data["fname_mao"] -@pytest.mark.requests_workflow def test_add_internal_comment(): request = RequestFactory.create() ccpo = UserFactory.from_atat_role("ccpo") @@ -221,7 +203,6 @@ def test_add_internal_comment(): assert request.internal_comments[0].text == "this is my comment" -@pytest.mark.requests_workflow def test_creator_can_view_own_request(): creator = UserFactory.create() request = RequestFactory.create(creator=creator) @@ -229,7 +210,6 @@ def test_creator_can_view_own_request(): assert RequestsAuthorization(creator, request).can_view -@pytest.mark.requests_workflow def test_ccpo_can_view_request(): ccpo = UserFactory.from_atat_role("ccpo") request = RequestFactory.create() @@ -237,7 +217,6 @@ def test_ccpo_can_view_request(): assert RequestsAuthorization(ccpo, request).can_view -@pytest.mark.requests_workflow def test_random_user_cannot_view_request(): user = UserFactory.create() request = RequestFactory.create() @@ -245,7 +224,6 @@ def test_random_user_cannot_view_request(): assert not RequestsAuthorization(user, request).can_view -@pytest.mark.requests_workflow def test_auto_approve_and_create_workspace(): request = RequestFactory.create() workspace = Requests.auto_approve_and_create_workspace(request) @@ -261,7 +239,6 @@ class TestStatusNotifications(object): assert job.func == queue._send_mail assert job.args[0] == [request.creator.email] - @pytest.mark.requests_workflow def test_pending_finver_triggers_notification(self, queue): request = RequestFactory.create() request = Requests.set_status(request, RequestStatus.PENDING_CCPO_ACCEPTANCE) @@ -270,14 +247,12 @@ class TestStatusNotifications(object): ) self._assert_job(queue, request) - @pytest.mark.requests_workflow def test_changes_requested_triggers_notification(self, queue): request = RequestFactory.create() request = Requests.set_status(request, RequestStatus.PENDING_CCPO_ACCEPTANCE) request = Requests.set_status(request, RequestStatus.CHANGES_REQUESTED) self._assert_job(queue, request) - @pytest.mark.requests_workflow def test_changes_requested_to_finver_triggers_notification(self, queue): request = RequestFactory.create() request = Requests.set_status(request, RequestStatus.PENDING_CCPO_APPROVAL) @@ -286,14 +261,12 @@ class TestStatusNotifications(object): ) self._assert_job(queue, request) - @pytest.mark.requests_workflow def test_approval_triggers_notification(self, queue): request = RequestFactory.create() request = Requests.set_status(request, RequestStatus.PENDING_CCPO_APPROVAL) request = Requests.set_status(request, RequestStatus.APPROVED) self._assert_job(queue, request) - @pytest.mark.requests_workflow def test_submitted_does_not_trigger_notification(self, queue): request = RequestFactory.create() request = Requests.set_status(request, RequestStatus.SUBMITTED) diff --git a/tests/routes/requests/requests_form/test_details.py b/tests/routes/requests/requests_form/test_details.py index 27986112..ddeade54 100644 --- a/tests/routes/requests/requests_form/test_details.py +++ b/tests/routes/requests/requests_form/test_details.py @@ -1,4 +1,3 @@ -import pytest import re from flask import url_for @@ -7,7 +6,6 @@ from atst.models.request_status_event import RequestStatus from tests.factories import RequestFactory, LegacyTaskOrderFactory, UserFactory -@pytest.mark.requests_workflow def test_can_show_financial_data(client, user_session): user = UserFactory.create() user_session(user) @@ -26,7 +24,6 @@ def test_can_show_financial_data(client, user_session): assert re.search(r">\s+Financial Verification\s+<", body) -@pytest.mark.requests_workflow def test_can_not_show_financial_data(client, user_session): user = UserFactory.create() user_session(user) diff --git a/tests/routes/requests/requests_form/test_edit.py b/tests/routes/requests/requests_form/test_edit.py index 70fa8b9d..37e7b243 100644 --- a/tests/routes/requests/requests_form/test_edit.py +++ b/tests/routes/requests/requests_form/test_edit.py @@ -1,9 +1,7 @@ -import pytest from tests.factories import UserFactory, RequestFactory from atst.models.request_status_event import RequestStatus -@pytest.mark.requests_workflow def test_creator_pending_finver(client, user_session): request = RequestFactory.create_with_status( RequestStatus.PENDING_FINANCIAL_VERIFICATION @@ -15,7 +13,6 @@ def test_creator_pending_finver(client, user_session): assert "verify" in response.location -@pytest.mark.requests_workflow def test_creator_pending_finver_changes(client, user_session): request = RequestFactory.create_with_status( RequestStatus.CHANGES_REQUESTED_TO_FINVER @@ -27,7 +24,6 @@ def test_creator_pending_finver_changes(client, user_session): assert "verify" in response.location -@pytest.mark.requests_workflow def test_creator_approved(client, user_session): request = RequestFactory.create_with_status(RequestStatus.APPROVED) user_session(request.creator) @@ -37,7 +33,6 @@ def test_creator_approved(client, user_session): assert "details" in response.location -@pytest.mark.requests_workflow def test_creator_approved(client, user_session): request = RequestFactory.create_with_status(RequestStatus.STARTED) user_session(request.creator) @@ -47,7 +42,6 @@ def test_creator_approved(client, user_session): assert "new" in response.location -@pytest.mark.requests_workflow def test_ccpo(client, user_session): ccpo = UserFactory.from_atat_role("ccpo") request = RequestFactory.create_with_status(RequestStatus.STARTED) diff --git a/tests/routes/requests/requests_form/test_new.py b/tests/routes/requests/requests_form/test_new.py index ce55fc27..81d195a8 100644 --- a/tests/routes/requests/requests_form/test_new.py +++ b/tests/routes/requests/requests_form/test_new.py @@ -1,4 +1,3 @@ -import pytest import datetime import re from tests.factories import ( @@ -18,7 +17,6 @@ from tests.assert_util import dict_contains ERROR_CLASS = "alert--error" -@pytest.mark.requests_workflow def test_submit_invalid_request_form(monkeypatch, client, user_session): user_session() response = client.post( @@ -29,7 +27,6 @@ def test_submit_invalid_request_form(monkeypatch, client, user_session): assert re.search(ERROR_CLASS, response.data.decode()) -@pytest.mark.requests_workflow def test_submit_valid_request_form(monkeypatch, client, user_session): user_session() monkeypatch.setattr( @@ -44,7 +41,6 @@ def test_submit_valid_request_form(monkeypatch, client, user_session): assert "/requests/new/2" in response.headers.get("Location") -@pytest.mark.requests_workflow def test_owner_can_view_request(client, user_session): user = UserFactory.create() user_session(user) @@ -57,7 +53,6 @@ def test_owner_can_view_request(client, user_session): assert response.status_code == 200 -@pytest.mark.requests_workflow def test_non_owner_cannot_view_request(client, user_session): user = UserFactory.create() user_session(user) @@ -70,7 +65,6 @@ def test_non_owner_cannot_view_request(client, user_session): assert response.status_code == 404 -@pytest.mark.requests_workflow def test_ccpo_can_view_request(client, user_session): ccpo = Roles.get("ccpo") user = UserFactory.create(atat_role=ccpo) @@ -84,7 +78,6 @@ def test_ccpo_can_view_request(client, user_session): assert response.status_code == 200 -@pytest.mark.requests_workflow def test_nonexistent_request(client, user_session): user_session() response = client.get("/requests/new/1/foo", follow_redirects=True) @@ -92,7 +85,6 @@ def test_nonexistent_request(client, user_session): assert response.status_code == 404 -@pytest.mark.requests_workflow def test_creator_info_is_autopopulated_for_existing_request( monkeypatch, client, user_session ): @@ -116,7 +108,6 @@ def test_creator_info_is_autopopulated_for_existing_request( assert "initial-value='{}'".format(value) in body -@pytest.mark.requests_workflow def test_creator_info_is_autopopulated_for_new_request( monkeypatch, client, user_session ): @@ -130,7 +121,6 @@ def test_creator_info_is_autopopulated_for_new_request( assert "initial-value='{}'".format(user.email) in body -@pytest.mark.requests_workflow def test_non_creator_info_is_not_autopopulated(monkeypatch, client, user_session): user = UserFactory.create() creator = UserFactory.create() @@ -144,7 +134,6 @@ def test_non_creator_info_is_not_autopopulated(monkeypatch, client, user_session assert not user.email in body -@pytest.mark.requests_workflow def test_am_poc_causes_poc_to_be_autopopulated(client, user_session): creator = UserFactory.create() user_session(creator) @@ -158,7 +147,6 @@ def test_am_poc_causes_poc_to_be_autopopulated(client, user_session): assert request.body["primary_poc"]["dodid_poc"] == creator.dod_id -@pytest.mark.requests_workflow def test_not_am_poc_requires_poc_info_to_be_completed(client, user_session): creator = UserFactory.create() user_session(creator) @@ -172,7 +160,6 @@ def test_not_am_poc_requires_poc_info_to_be_completed(client, user_session): assert ERROR_CLASS in response.data.decode() -@pytest.mark.requests_workflow def test_not_am_poc_allows_user_to_fill_in_poc_info(client, user_session): creator = UserFactory.create() user_session(creator) @@ -192,7 +179,6 @@ def test_not_am_poc_allows_user_to_fill_in_poc_info(client, user_session): assert ERROR_CLASS not in response.data.decode() -@pytest.mark.requests_workflow def test_poc_details_can_be_autopopulated_on_new_request(client, user_session): creator = UserFactory.create() user_session(creator) @@ -207,7 +193,6 @@ def test_poc_details_can_be_autopopulated_on_new_request(client, user_session): assert request.body["primary_poc"]["dodid_poc"] == creator.dod_id -@pytest.mark.requests_workflow def test_poc_autofill_checks_information_about_you_form_first(client, user_session): creator = UserFactory.create() user_session(creator) @@ -236,7 +221,6 @@ def test_poc_autofill_checks_information_about_you_form_first(client, user_sessi ) -@pytest.mark.requests_workflow def test_can_review_data(user_session, client): creator = UserFactory.create() user_session(creator) @@ -248,7 +232,6 @@ def test_can_review_data(user_session, client): assert request.body["information_about_you"]["email_request"] in body -@pytest.mark.requests_workflow def test_displays_ccpo_review_comment(user_session, client): creator = UserFactory.create() ccpo = UserFactory.from_atat_role("ccpo") diff --git a/tests/routes/requests/requests_form/test_submit.py b/tests/routes/requests/requests_form/test_submit.py index a214a355..f5f9c1d8 100644 --- a/tests/routes/requests/requests_form/test_submit.py +++ b/tests/routes/requests/requests_form/test_submit.py @@ -8,7 +8,6 @@ def _mock_func(*args, **kwargs): return RequestFactory.create() -@pytest.mark.requests_workflow def test_submit_reviewed_request(monkeypatch, client, user_session): user_session() monkeypatch.setattr("atst.domain.requests.Requests.get", _mock_func) @@ -25,7 +24,6 @@ def test_submit_reviewed_request(monkeypatch, client, user_session): assert "modal=pendingCCPOAcceptance" in response.headers["Location"] -@pytest.mark.requests_workflow def test_submit_autoapproved_reviewed_request(monkeypatch, client, user_session): user_session() monkeypatch.setattr("atst.domain.requests.Requests.get", _mock_func) diff --git a/tests/routes/requests/test_approval.py b/tests/routes/requests/test_approval.py index ba2fe6a5..9d507789 100644 --- a/tests/routes/requests/test_approval.py +++ b/tests/routes/requests/test_approval.py @@ -1,4 +1,3 @@ -import pytest import os from flask import url_for @@ -15,7 +14,6 @@ from tests.factories import ( ) -@pytest.mark.requests_workflow def test_ccpo_can_view_approval(user_session, client): ccpo = Roles.get("ccpo") user = UserFactory.create(atat_role=ccpo) @@ -26,7 +24,6 @@ def test_ccpo_can_view_approval(user_session, client): assert response.status_code == 200 -@pytest.mark.requests_workflow def test_ccpo_prepopulated_as_mission_owner(user_session, client): user = UserFactory.from_atat_role("ccpo") user_session(user) @@ -39,7 +36,6 @@ def test_ccpo_prepopulated_as_mission_owner(user_session, client): assert user.last_name in body -@pytest.mark.requests_workflow def test_non_ccpo_cannot_view_approval(user_session, client): user = UserFactory.create() user_session(user) @@ -49,7 +45,6 @@ def test_non_ccpo_cannot_view_approval(user_session, client): assert response.status_code == 404 -@pytest.mark.requests_workflow def prepare_request_pending_approval(creator, pdf_attachment=None): legacy_task_order = LegacyTaskOrderFactory.create( number="abc123", pdf=pdf_attachment @@ -61,7 +56,6 @@ def prepare_request_pending_approval(creator, pdf_attachment=None): ) -@pytest.mark.requests_workflow def test_ccpo_sees_pdf_link(user_session, client, pdf_upload): ccpo = UserFactory.from_atat_role("ccpo") user_session(ccpo) @@ -76,7 +70,6 @@ def test_ccpo_sees_pdf_link(user_session, client, pdf_upload): assert download_url in body -@pytest.mark.requests_workflow def test_ccpo_does_not_see_pdf_link_if_no_pdf(user_session, client, pdf_upload): ccpo = UserFactory.from_atat_role("ccpo") user_session(ccpo) @@ -90,7 +83,6 @@ def test_ccpo_does_not_see_pdf_link_if_no_pdf(user_session, client, pdf_upload): assert download_url not in body -@pytest.mark.requests_workflow def test_task_order_download(app, client, user_session, pdf_upload): user = UserFactory.create() user_session(user) @@ -116,7 +108,6 @@ def test_task_order_download(app, client, user_session, pdf_upload): assert response.data == pdf_content -@pytest.mark.requests_workflow def test_task_order_download_does_not_exist(client, user_session): user = UserFactory.create() user_session(user) @@ -127,7 +118,6 @@ def test_task_order_download_does_not_exist(client, user_session): assert response.status_code == 404 -@pytest.mark.requests_workflow def test_can_submit_request_approval(client, user_session): user = UserFactory.from_atat_role("ccpo") user_session(user) @@ -143,7 +133,6 @@ def test_can_submit_request_approval(client, user_session): assert request.status == RequestStatus.PENDING_FINANCIAL_VERIFICATION -@pytest.mark.requests_workflow def test_can_submit_request_denial(client, user_session): user = UserFactory.from_atat_role("ccpo") user_session(user) @@ -159,7 +148,6 @@ def test_can_submit_request_denial(client, user_session): assert request.status == RequestStatus.CHANGES_REQUESTED -@pytest.mark.requests_workflow def test_ccpo_user_can_comment_on_request(client, user_session): user = UserFactory.from_atat_role("ccpo") user_session(user) @@ -179,7 +167,6 @@ def test_ccpo_user_can_comment_on_request(client, user_session): assert request.internal_comments[0].text == comment_text -@pytest.mark.requests_workflow def test_comment_text_is_required(client, user_session): user = UserFactory.from_atat_role("ccpo") user_session(user) @@ -197,7 +184,6 @@ def test_comment_text_is_required(client, user_session): assert len(request.internal_comments) == 0 -@pytest.mark.requests_workflow def test_other_user_cannot_comment_on_request(client, user_session): user = UserFactory.create() user_session(user) diff --git a/tests/routes/requests/test_financial_verification.py b/tests/routes/requests/test_financial_verification.py index f7ab9d77..734d0864 100644 --- a/tests/routes/requests/test_financial_verification.py +++ b/tests/routes/requests/test_financial_verification.py @@ -69,7 +69,6 @@ FalseValidator = MagicMock() FalseValidator.validate = MagicMock(return_value=False) -@pytest.mark.requests_workflow def test_update_fv(fv_data): request = RequestFactory.create() user = UserFactory.create() @@ -82,7 +81,6 @@ def test_update_fv(fv_data): assert updated_request.is_pending_ccpo_approval -@pytest.mark.requests_workflow def test_update_fv_re_enter_pe_number(fv_data): request = RequestFactory.create() user = UserFactory.create() @@ -98,7 +96,6 @@ def test_update_fv_re_enter_pe_number(fv_data): assert updated_request.is_pending_ccpo_approval -@pytest.mark.requests_workflow def test_update_fv_invalid_task_order_number(fv_data): request = RequestFactory.create() user = UserFactory.create() @@ -116,7 +113,6 @@ def test_update_fv_invalid_task_order_number(fv_data): update_fv.execute() -@pytest.mark.requests_workflow def test_draft_without_pe_id(fv_data): request = RequestFactory.create() user = UserFactory.create() @@ -131,7 +127,6 @@ def test_draft_without_pe_id(fv_data): ).execute() -@pytest.mark.requests_workflow def test_update_fv_extended(fv_data, e_fv_data): request = RequestFactory.create() user = UserFactory.create() @@ -143,7 +138,6 @@ def test_update_fv_extended(fv_data, e_fv_data): assert update_fv.execute() -@pytest.mark.requests_workflow def test_update_fv_extended_does_not_validate_task_order(fv_data, e_fv_data): request = RequestFactory.create() user = UserFactory.create() @@ -155,7 +149,6 @@ def test_update_fv_extended_does_not_validate_task_order(fv_data, e_fv_data): assert update_fv.execute() -@pytest.mark.requests_workflow def test_update_fv_missing_extended_data(fv_data): request = RequestFactory.create() user = UserFactory.create() @@ -172,7 +165,6 @@ def test_update_fv_missing_extended_data(fv_data): update_fv.execute() -@pytest.mark.requests_workflow def test_update_fv_submission(fv_data): request = RequestFactory.create() user = UserFactory.create() @@ -182,7 +174,6 @@ def test_update_fv_submission(fv_data): assert updated_request -@pytest.mark.requests_workflow def test_save_empty_draft(): request = RequestFactory.create() user = UserFactory.create() @@ -193,7 +184,6 @@ def test_save_empty_draft(): assert save_draft.execute() -@pytest.mark.requests_workflow def test_save_draft_with_ba_code(): request = RequestFactory.create() user = UserFactory.create() @@ -205,7 +195,6 @@ def test_save_draft_with_ba_code(): assert save_draft.execute() -@pytest.mark.requests_workflow def test_save_draft_allows_invalid_data(): request = RequestFactory.create() user = UserFactory.create() @@ -225,7 +214,6 @@ def test_save_draft_allows_invalid_data(): ).execute() -@pytest.mark.requests_workflow def test_save_draft_and_then_submit(): request = RequestFactory.create() user = UserFactory.create() @@ -240,7 +228,6 @@ def test_save_draft_and_then_submit(): ).execute() -@pytest.mark.requests_workflow def test_updated_request_has_pdf(fv_data, e_fv_data): request = RequestFactory.create() user = UserFactory.create() @@ -251,7 +238,6 @@ def test_updated_request_has_pdf(fv_data, e_fv_data): assert updated_request.legacy_task_order.pdf -@pytest.mark.requests_workflow def test_can_save_draft_with_just_pdf(e_fv_data): request = RequestFactory.create() user = UserFactory.create() @@ -264,7 +250,6 @@ def test_can_save_draft_with_just_pdf(e_fv_data): assert form.legacy_task_order.pdf -@pytest.mark.requests_workflow def test_task_order_info_present_in_extended_form(fv_data, e_fv_data): request = RequestFactory.create() user = UserFactory.create() @@ -280,7 +265,6 @@ def test_task_order_info_present_in_extended_form(fv_data, e_fv_data): assert form.legacy_task_order.clin_0001.data -@pytest.mark.requests_workflow def test_update_ignores_empty_values(fv_data, e_fv_data): request = RequestFactory.create() user = UserFactory.create() @@ -290,7 +274,6 @@ def test_update_ignores_empty_values(fv_data, e_fv_data): ).execute() -@pytest.mark.requests_workflow def test_can_save_draft_with_funding_type(fv_data, e_fv_data): request = RequestFactory.create() user = UserFactory.create() @@ -305,7 +288,6 @@ def test_can_save_draft_with_funding_type(fv_data, e_fv_data): assert updated_request.legacy_task_order.funding_type -@pytest.mark.requests_workflow def test_update_fv_route(client, user_session, fv_data): user = UserFactory.create() request = RequestFactory.create(creator=user) @@ -319,7 +301,6 @@ def test_update_fv_route(client, user_session, fv_data): assert response.status_code == 200 -@pytest.mark.requests_workflow def test_save_fv_draft_route(client, user_session, fv_data): user = UserFactory.create() request = RequestFactory.create(creator=user) @@ -333,7 +314,6 @@ def test_save_fv_draft_route(client, user_session, fv_data): assert response.status_code == 200 -@pytest.mark.requests_workflow def test_get_fv_form_route(client, user_session, fv_data): user = UserFactory.create() request = RequestFactory.create(creator=user) @@ -347,7 +327,6 @@ def test_get_fv_form_route(client, user_session, fv_data): assert response.status_code == 200 -@pytest.mark.requests_workflow def test_manual_task_order_triggers_extended_form( client, user_session, fv_data, e_fv_data ): @@ -369,7 +348,6 @@ def test_manual_task_order_triggers_extended_form( assert "extended" in response.headers["Location"] -@pytest.mark.requests_workflow def test_manual_to_does_not_trigger_approval(client, user_session, fv_data, e_fv_data): user = UserFactory.create() request = RequestFactory.create(creator=user) @@ -392,7 +370,6 @@ def test_manual_to_does_not_trigger_approval(client, user_session, fv_data, e_fv assert updated_request.status != RequestStatus.APPROVED -@pytest.mark.requests_workflow def test_eda_task_order_does_trigger_approval(client, user_session, fv_data, e_fv_data): user = UserFactory.create() request = RequestFactory.create(creator=user) @@ -415,7 +392,6 @@ def test_eda_task_order_does_trigger_approval(client, user_session, fv_data, e_f assert updated_request.status == RequestStatus.APPROVED -@pytest.mark.requests_workflow def test_attachment_on_non_extended_form(client, user_session, fv_data, e_fv_data): user = UserFactory.create() request = RequestFactory.create(creator=user) @@ -441,7 +417,6 @@ def test_attachment_on_non_extended_form(client, user_session, fv_data, e_fv_dat assert response.status_code == 200 -@pytest.mark.requests_workflow def test_task_order_number_persists_in_form(fv_data, e_fv_data): user = UserFactory.create() request = RequestFactory.create(creator=user) @@ -462,7 +437,6 @@ def test_task_order_number_persists_in_form(fv_data, e_fv_data): assert form.legacy_task_order.number.data == MANUAL_TO_NUMBER -@pytest.mark.requests_workflow def test_can_submit_once_to_details_are_entered(fv_data, e_fv_data): user = UserFactory.create() request = RequestFactory.create(creator=user) @@ -490,7 +464,6 @@ def test_can_submit_once_to_details_are_entered(fv_data, e_fv_data): ).execute() -@pytest.mark.requests_workflow def test_existing_task_order_with_pdf(fv_data, e_fv_data, client, user_session): # Use finver route to create initial TO #1, complete with PDF user = UserFactory.create() @@ -523,7 +496,6 @@ def test_existing_task_order_with_pdf(fv_data, e_fv_data, client, user_session): assert response.status_code == 200 -@pytest.mark.requests_workflow def test_pdf_clearing(fv_data, e_fv_data, pdf_upload, pdf_upload2): user = UserFactory.create() request = RequestFactory.create(creator=user) @@ -549,7 +521,6 @@ def test_pdf_clearing(fv_data, e_fv_data, pdf_upload, pdf_upload2): # in the related attachment entity. I have changed the handling in # FinancialVerificationBase#_get_form to be more generous in how it finds the # PDF filename and prepopulates the form data with that name. -@pytest.mark.requests_workflow def test_always_derives_pdf_filename(fv_data, e_fv_data, pdf_upload): user = UserFactory.create() request_one = RequestFactory.create(creator=user) diff --git a/tests/routes/requests/test_requests_index.py b/tests/routes/requests/test_requests_index.py index 021e81bf..a5ce31c3 100644 --- a/tests/routes/requests/test_requests_index.py +++ b/tests/routes/requests/test_requests_index.py @@ -1,4 +1,3 @@ -import pytest from flask import url_for from atst.routes.requests.index import RequestsIndex @@ -6,7 +5,6 @@ from tests.factories import RequestFactory, UserFactory from atst.domain.requests import Requests -@pytest.mark.requests_workflow def test_action_required_mission_owner(): creator = UserFactory.create() requests = RequestFactory.create_batch(5, creator=creator) @@ -18,7 +16,6 @@ def test_action_required_mission_owner(): assert context["requests"][0]["action_required"] == False -@pytest.mark.requests_workflow def test_action_required_ccpo(): creator = UserFactory.create() requests = RequestFactory.create_batch(5, creator=creator) diff --git a/tests/test_integration.py b/tests/test_integration.py index aa22eb50..152e960b 100644 --- a/tests/test_integration.py +++ b/tests/test_integration.py @@ -26,7 +26,6 @@ def serialize_dates(data): return new_data -@pytest.mark.requests_workflow def test_stepthrough_request_form(user_session, screens, client): user = UserFactory.create() user_session(user) From d53400ee79af00d5ea162898b82602a0e39e2286 Mon Sep 17 00:00:00 2001 From: Montana Date: Fri, 11 Jan 2019 11:30:52 -0500 Subject: [PATCH 6/7] Fix invites bug that used a method without all the needed arguments --- atst/routes/task_orders/invite.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/atst/routes/task_orders/invite.py b/atst/routes/task_orders/invite.py index c43f14b5..dc044309 100644 --- a/atst/routes/task_orders/invite.py +++ b/atst/routes/task_orders/invite.py @@ -1,4 +1,4 @@ -from flask import redirect, url_for +from flask import redirect, url_for, g from . import task_orders_bp from atst.domain.task_orders import TaskOrders @@ -8,7 +8,7 @@ from atst.utils.flash import formatted_flash as flash # TODO: add a real implementation for this @task_orders_bp.route("/task_orders/invite/", methods=["POST"]) def invite(task_order_id): - task_order = TaskOrders.get(task_order_id) + task_order = TaskOrders.get(g.current_user, task_order_id) flash("task_order_submitted", task_order=task_order) return redirect( url_for("workspaces.workspace_members", workspace_id=task_order.workspace.id) From e0d9bd033593cf0e54911ef9dae4403409c56654 Mon Sep 17 00:00:00 2001 From: Montana Date: Fri, 11 Jan 2019 13:21:42 -0500 Subject: [PATCH 7/7] Add test for TO invite route --- atst/routes/task_orders/invite.py | 1 - tests/routes/task_orders/test_invite.py | 11 +++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 tests/routes/task_orders/test_invite.py diff --git a/atst/routes/task_orders/invite.py b/atst/routes/task_orders/invite.py index dc044309..78e2daf5 100644 --- a/atst/routes/task_orders/invite.py +++ b/atst/routes/task_orders/invite.py @@ -5,7 +5,6 @@ from atst.domain.task_orders import TaskOrders from atst.utils.flash import formatted_flash as flash -# TODO: add a real implementation for this @task_orders_bp.route("/task_orders/invite/", methods=["POST"]) def invite(task_order_id): task_order = TaskOrders.get(g.current_user, task_order_id) diff --git a/tests/routes/task_orders/test_invite.py b/tests/routes/task_orders/test_invite.py new file mode 100644 index 00000000..39cfeb76 --- /dev/null +++ b/tests/routes/task_orders/test_invite.py @@ -0,0 +1,11 @@ +import pytest +from flask import url_for + +from tests.factories import TaskOrderFactory + + +def test_invite(client): + to = TaskOrderFactory.create() + response = client.post( + url_for("task_orders.invite", task_order_id=to.id), follow_redirects=False + )