From 864e11ea114e430b6e011096690bd1e773959ebc Mon Sep 17 00:00:00 2001 From: leigh-mil Date: Fri, 9 Aug 2019 10:09:23 -0400 Subject: [PATCH] Remove redundant 'ccpo' from ccpo route function names --- atst/routes/ccpo.py | 10 +++++----- templates/ccpo/add_user.html | 4 ++-- templates/ccpo/confirm_user.html | 6 +++--- templates/ccpo/users.html | 2 +- tests/routes/test_ccpo.py | 14 +++++++------- tests/test_access.py | 24 ++++++++++++------------ 6 files changed, 30 insertions(+), 30 deletions(-) diff --git a/atst/routes/ccpo.py b/atst/routes/ccpo.py index d7c0f048..90aaa03f 100644 --- a/atst/routes/ccpo.py +++ b/atst/routes/ccpo.py @@ -24,21 +24,21 @@ def activity_history(): @bp.route("/ccpo-users") @user_can(Permissions.VIEW_CCPO_USER, message="view ccpo users") -def ccpo_users(): +def users(): users = Users.get_ccpo_users() return render_template("ccpo/users.html", users=users) @bp.route("/ccpo-users/new") @user_can(Permissions.CREATE_CCPO_USER, message="create ccpo user") -def add_new_ccpo_user(): +def add_new_user(): form = CCPOUserForm() return render_template("ccpo/add_user.html", form=form) @bp.route("/ccpo-users/new", methods=["POST"]) @user_can(Permissions.CREATE_CCPO_USER, message="create ccpo user") -def submit_add_new_ccpo_user(): +def submit_new_user(): try: new_user = Users.get_by_dod_id(request.form["dod_id"]) form = CCPOUserForm(obj=new_user) @@ -51,8 +51,8 @@ def submit_add_new_ccpo_user(): @bp.route("/ccpo-users/confirm-new", methods=["POST"]) @user_can(Permissions.CREATE_CCPO_USER, message="create ccpo user") -def confirm_new_ccpo_user(): +def confirm_new_user(): user = Users.get_by_dod_id(request.form["dod_id"]) Users.give_ccpo_perms(user) flash("ccpo_user_added", user_name=user.full_name) - return redirect(url_for("ccpo.ccpo_users")) + return redirect(url_for("ccpo.users")) diff --git a/templates/ccpo/add_user.html b/templates/ccpo/add_user.html index 15dfed75..b3b9b0f5 100644 --- a/templates/ccpo/add_user.html +++ b/templates/ccpo/add_user.html @@ -3,7 +3,7 @@ {% from "components/text_input.html" import TextInput %} {% block content %} -
+ {{ form.csrf_token }}

{{ "ccpo.form.add_user_title" | translate }}

@@ -17,7 +17,7 @@ v-bind:disabled="invalid" class='action-group__action usa-button' value='{{ "common.next" | translate }}'> - {{ "common.cancel" | translate }} + {{ "common.cancel" | translate }}
diff --git a/templates/ccpo/confirm_user.html b/templates/ccpo/confirm_user.html index 5c54086d..1304fa97 100644 --- a/templates/ccpo/confirm_user.html +++ b/templates/ccpo/confirm_user.html @@ -6,7 +6,7 @@ {% block content %} {% if new_user %} {% call Alert('ccpo.form.confirm_user_title' | translate) %} - + {{ form.csrf_token }}
@@ -26,7 +26,7 @@ v-bind:disabled="invalid" class='action-group__action usa-button' value='{{ "ccpo.form.confirm_button" | translate }}'> - + {{ "common.cancel" | translate }}
@@ -38,7 +38,7 @@ {{ "ccpo.form.user_not_found_text" | translate }}

diff --git a/templates/ccpo/users.html b/templates/ccpo/users.html index 9e4c0fab..3195fb36 100644 --- a/templates/ccpo/users.html +++ b/templates/ccpo/users.html @@ -31,7 +31,7 @@ {% if user_can(permissions.CREATE_CCPO_USER) %} - + {{ "ccpo.add_user" | translate }} {{ Icon("plus") }} {% endif %} diff --git a/tests/routes/test_ccpo.py b/tests/routes/test_ccpo.py index 1e22e5b8..9cbd6159 100644 --- a/tests/routes/test_ccpo.py +++ b/tests/routes/test_ccpo.py @@ -8,11 +8,11 @@ from tests.factories import UserFactory def test_ccpo_users(user_session, client): ccpo = UserFactory.create_ccpo() user_session(ccpo) - response = client.get(url_for("ccpo.ccpo_users")) + response = client.get(url_for("ccpo.users")) assert ccpo.email in response.data.decode() -def test_submit_add_new_ccpo_user(user_session, client): +def test_submit_new_user(user_session, client): ccpo = UserFactory.create_ccpo() new_user = UserFactory.create() random_dod_id = "1234567890" @@ -20,18 +20,18 @@ def test_submit_add_new_ccpo_user(user_session, client): # give new_user CCPO permissions response = client.post( - url_for("ccpo.submit_add_new_ccpo_user"), data={"dod_id": new_user.dod_id} + url_for("ccpo.submit_new_user"), data={"dod_id": new_user.dod_id} ) assert new_user.email in response.data.decode() # give person with out ATAT account CCPO permissions response = client.post( - url_for("ccpo.submit_add_new_ccpo_user"), data={"dod_id": random_dod_id} + url_for("ccpo.submit_new_user"), data={"dod_id": random_dod_id} ) assert translate("ccpo.form.user_not_found_title") in response.data.decode() -def test_confirm_new_ccpo_user(user_session, client): +def test_confirm_new_user(user_session, client): ccpo = UserFactory.create_ccpo() new_user = UserFactory.create() random_dod_id = "1234567890" @@ -39,7 +39,7 @@ def test_confirm_new_ccpo_user(user_session, client): # give new_user CCPO permissions response = client.post( - url_for("ccpo.confirm_new_ccpo_user"), + url_for("ccpo.confirm_new_user"), data={"dod_id": new_user.dod_id}, follow_redirects=True, ) @@ -47,7 +47,7 @@ def test_confirm_new_ccpo_user(user_session, client): # give person with out ATAT account CCPO permissions response = client.post( - url_for("ccpo.confirm_new_ccpo_user"), + url_for("ccpo.confirm_new_user"), data={"dod_id": random_dod_id}, follow_redirects=True, ) diff --git a/tests/test_access.py b/tests/test_access.py index b02cf489..43e842d2 100644 --- a/tests/test_access.py +++ b/tests/test_access.py @@ -120,43 +120,43 @@ def test_atst_activity_history_access(get_url_assert_status): get_url_assert_status(rando, url, 404) -# ccpo.ccpo_users -def test_ccpo_ccpo_users_access(get_url_assert_status): +# ccpo.users +def test_ccpo_users_access(get_url_assert_status): ccpo = user_with(PermissionSets.MANAGE_CCPO_USERS) rando = user_with() - url = url_for("ccpo.ccpo_users") + url = url_for("ccpo.users") get_url_assert_status(ccpo, url, 200) get_url_assert_status(rando, url, 404) -# ccpo.add_new_ccpo_user -def test_ccpo_add_new_ccpo_user_access(get_url_assert_status): +# ccpo.add_new_user +def test_ccpo_add_new_user_access(get_url_assert_status): ccpo = user_with(PermissionSets.MANAGE_CCPO_USERS) rando = user_with() - url = url_for("ccpo.add_new_ccpo_user") + url = url_for("ccpo.add_new_user") get_url_assert_status(ccpo, url, 200) get_url_assert_status(rando, url, 404) -# ccpo.submit_add_new_ccpo_user -def test_ccpo_submit_add_new_ccpo_user_access(post_url_assert_status): +# ccpo.submit_new_user +def test_ccpo_submit_new_user_access(post_url_assert_status): ccpo = user_with(PermissionSets.MANAGE_CCPO_USERS) rando = user_with() - url = url_for("ccpo.submit_add_new_ccpo_user") + url = url_for("ccpo.submit_new_user") post_url_assert_status(ccpo, url, 200, data={"dod_id": "1234567890"}) post_url_assert_status(rando, url, 404, data={"dod_id": "1234567890"}) -# ccpo.confirm_new_ccpo_user -def test_ccpo_confirm_new_ccpo_user_access(post_url_assert_status): +# ccpo.confirm_new_user +def test_ccpo_confirm_new_user_access(post_url_assert_status): ccpo = user_with(PermissionSets.MANAGE_CCPO_USERS) rando = user_with() user = UserFactory.create() - url = url_for("ccpo.confirm_new_ccpo_user") + url = url_for("ccpo.confirm_new_user") post_url_assert_status(ccpo, url, 302, data={"dod_id": user.dod_id}) post_url_assert_status(rando, url, 404, data={"dod_id": user.dod_id})