Remove redundant 'ccpo' from ccpo route function names
This commit is contained in:
parent
feb24b8e16
commit
864e11ea11
@ -24,21 +24,21 @@ def activity_history():
|
|||||||
|
|
||||||
@bp.route("/ccpo-users")
|
@bp.route("/ccpo-users")
|
||||||
@user_can(Permissions.VIEW_CCPO_USER, message="view ccpo users")
|
@user_can(Permissions.VIEW_CCPO_USER, message="view ccpo users")
|
||||||
def ccpo_users():
|
def users():
|
||||||
users = Users.get_ccpo_users()
|
users = Users.get_ccpo_users()
|
||||||
return render_template("ccpo/users.html", users=users)
|
return render_template("ccpo/users.html", users=users)
|
||||||
|
|
||||||
|
|
||||||
@bp.route("/ccpo-users/new")
|
@bp.route("/ccpo-users/new")
|
||||||
@user_can(Permissions.CREATE_CCPO_USER, message="create ccpo user")
|
@user_can(Permissions.CREATE_CCPO_USER, message="create ccpo user")
|
||||||
def add_new_ccpo_user():
|
def add_new_user():
|
||||||
form = CCPOUserForm()
|
form = CCPOUserForm()
|
||||||
return render_template("ccpo/add_user.html", form=form)
|
return render_template("ccpo/add_user.html", form=form)
|
||||||
|
|
||||||
|
|
||||||
@bp.route("/ccpo-users/new", methods=["POST"])
|
@bp.route("/ccpo-users/new", methods=["POST"])
|
||||||
@user_can(Permissions.CREATE_CCPO_USER, message="create ccpo user")
|
@user_can(Permissions.CREATE_CCPO_USER, message="create ccpo user")
|
||||||
def submit_add_new_ccpo_user():
|
def submit_new_user():
|
||||||
try:
|
try:
|
||||||
new_user = Users.get_by_dod_id(request.form["dod_id"])
|
new_user = Users.get_by_dod_id(request.form["dod_id"])
|
||||||
form = CCPOUserForm(obj=new_user)
|
form = CCPOUserForm(obj=new_user)
|
||||||
@ -51,8 +51,8 @@ def submit_add_new_ccpo_user():
|
|||||||
|
|
||||||
@bp.route("/ccpo-users/confirm-new", methods=["POST"])
|
@bp.route("/ccpo-users/confirm-new", methods=["POST"])
|
||||||
@user_can(Permissions.CREATE_CCPO_USER, message="create ccpo user")
|
@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"])
|
user = Users.get_by_dod_id(request.form["dod_id"])
|
||||||
Users.give_ccpo_perms(user)
|
Users.give_ccpo_perms(user)
|
||||||
flash("ccpo_user_added", user_name=user.full_name)
|
flash("ccpo_user_added", user_name=user.full_name)
|
||||||
return redirect(url_for("ccpo.ccpo_users"))
|
return redirect(url_for("ccpo.users"))
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
{% from "components/text_input.html" import TextInput %}
|
{% from "components/text_input.html" import TextInput %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<form id="add-ccpo-user-form" action="{{ url_for('ccpo.submit_add_new_ccpo_user') }}" method="POST">
|
<form id="add-ccpo-user-form" action="{{ url_for('ccpo.submit_new_user') }}" method="POST">
|
||||||
{{ form.csrf_token }}
|
{{ form.csrf_token }}
|
||||||
<h1>{{ "ccpo.form.add_user_title" | translate }}</h1>
|
<h1>{{ "ccpo.form.add_user_title" | translate }}</h1>
|
||||||
<div class='form-row'>
|
<div class='form-row'>
|
||||||
@ -17,7 +17,7 @@
|
|||||||
v-bind:disabled="invalid"
|
v-bind:disabled="invalid"
|
||||||
class='action-group__action usa-button'
|
class='action-group__action usa-button'
|
||||||
value='{{ "common.next" | translate }}'>
|
value='{{ "common.next" | translate }}'>
|
||||||
<a class='action-group__action icon-link icon-link--default' href="{{ url_for('ccpo.ccpo_users') }}">{{ "common.cancel" | translate }}</a>
|
<a class='action-group__action icon-link icon-link--default' href="{{ url_for('ccpo.users') }}">{{ "common.cancel" | translate }}</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
{% block content %}
|
{% block content %}
|
||||||
{% if new_user %}
|
{% if new_user %}
|
||||||
{% call Alert('ccpo.form.confirm_user_title' | translate) %}
|
{% call Alert('ccpo.form.confirm_user_title' | translate) %}
|
||||||
<form id="add-ccpo-user-form" action="{{ url_for('ccpo.confirm_new_ccpo_user') }}" method="POST">
|
<form id="add-ccpo-user-form" action="{{ url_for('ccpo.confirm_new_user') }}" method="POST">
|
||||||
{{ form.csrf_token }}
|
{{ form.csrf_token }}
|
||||||
<input type="hidden" name="dod_id" value="{{ form.dod_id.data }}">
|
<input type="hidden" name="dod_id" value="{{ form.dod_id.data }}">
|
||||||
<div>
|
<div>
|
||||||
@ -26,7 +26,7 @@
|
|||||||
v-bind:disabled="invalid"
|
v-bind:disabled="invalid"
|
||||||
class='action-group__action usa-button'
|
class='action-group__action usa-button'
|
||||||
value='{{ "ccpo.form.confirm_button" | translate }}'>
|
value='{{ "ccpo.form.confirm_button" | translate }}'>
|
||||||
<a class='action-group__action icon-link icon-link--default' href="{{ url_for('ccpo.ccpo_users') }}">
|
<a class='action-group__action icon-link icon-link--default' href="{{ url_for('ccpo.users') }}">
|
||||||
{{ "common.cancel" | translate }}
|
{{ "common.cancel" | translate }}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
@ -38,7 +38,7 @@
|
|||||||
{{ "ccpo.form.user_not_found_text" | translate }}
|
{{ "ccpo.form.user_not_found_text" | translate }}
|
||||||
</p>
|
</p>
|
||||||
<div class='action-group'>
|
<div class='action-group'>
|
||||||
<a class='action-group__action icon-link icon-link--default' href="{{ url_for('ccpo.ccpo_users') }}">
|
<a class='action-group__action icon-link icon-link--default' href="{{ url_for('ccpo.users') }}">
|
||||||
{{ "ccpo.form.return_link" | translate }}
|
{{ "ccpo.form.return_link" | translate }}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% if user_can(permissions.CREATE_CCPO_USER) %}
|
{% if user_can(permissions.CREATE_CCPO_USER) %}
|
||||||
<a class="icon-link modal-link" href="{{ url_for('ccpo.add_new_ccpo_user')}}">
|
<a class="icon-link modal-link" href="{{ url_for('ccpo.add_new_user')}}">
|
||||||
{{ "ccpo.add_user" | translate }} {{ Icon("plus") }}
|
{{ "ccpo.add_user" | translate }} {{ Icon("plus") }}
|
||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -8,11 +8,11 @@ from tests.factories import UserFactory
|
|||||||
def test_ccpo_users(user_session, client):
|
def test_ccpo_users(user_session, client):
|
||||||
ccpo = UserFactory.create_ccpo()
|
ccpo = UserFactory.create_ccpo()
|
||||||
user_session(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()
|
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()
|
ccpo = UserFactory.create_ccpo()
|
||||||
new_user = UserFactory.create()
|
new_user = UserFactory.create()
|
||||||
random_dod_id = "1234567890"
|
random_dod_id = "1234567890"
|
||||||
@ -20,18 +20,18 @@ def test_submit_add_new_ccpo_user(user_session, client):
|
|||||||
|
|
||||||
# give new_user CCPO permissions
|
# give new_user CCPO permissions
|
||||||
response = client.post(
|
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()
|
assert new_user.email in response.data.decode()
|
||||||
|
|
||||||
# give person with out ATAT account CCPO permissions
|
# give person with out ATAT account CCPO permissions
|
||||||
response = client.post(
|
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()
|
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()
|
ccpo = UserFactory.create_ccpo()
|
||||||
new_user = UserFactory.create()
|
new_user = UserFactory.create()
|
||||||
random_dod_id = "1234567890"
|
random_dod_id = "1234567890"
|
||||||
@ -39,7 +39,7 @@ def test_confirm_new_ccpo_user(user_session, client):
|
|||||||
|
|
||||||
# give new_user CCPO permissions
|
# give new_user CCPO permissions
|
||||||
response = client.post(
|
response = client.post(
|
||||||
url_for("ccpo.confirm_new_ccpo_user"),
|
url_for("ccpo.confirm_new_user"),
|
||||||
data={"dod_id": new_user.dod_id},
|
data={"dod_id": new_user.dod_id},
|
||||||
follow_redirects=True,
|
follow_redirects=True,
|
||||||
)
|
)
|
||||||
@ -47,7 +47,7 @@ def test_confirm_new_ccpo_user(user_session, client):
|
|||||||
|
|
||||||
# give person with out ATAT account CCPO permissions
|
# give person with out ATAT account CCPO permissions
|
||||||
response = client.post(
|
response = client.post(
|
||||||
url_for("ccpo.confirm_new_ccpo_user"),
|
url_for("ccpo.confirm_new_user"),
|
||||||
data={"dod_id": random_dod_id},
|
data={"dod_id": random_dod_id},
|
||||||
follow_redirects=True,
|
follow_redirects=True,
|
||||||
)
|
)
|
||||||
|
@ -120,43 +120,43 @@ def test_atst_activity_history_access(get_url_assert_status):
|
|||||||
get_url_assert_status(rando, url, 404)
|
get_url_assert_status(rando, url, 404)
|
||||||
|
|
||||||
|
|
||||||
# ccpo.ccpo_users
|
# ccpo.users
|
||||||
def test_ccpo_ccpo_users_access(get_url_assert_status):
|
def test_ccpo_users_access(get_url_assert_status):
|
||||||
ccpo = user_with(PermissionSets.MANAGE_CCPO_USERS)
|
ccpo = user_with(PermissionSets.MANAGE_CCPO_USERS)
|
||||||
rando = user_with()
|
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(ccpo, url, 200)
|
||||||
get_url_assert_status(rando, url, 404)
|
get_url_assert_status(rando, url, 404)
|
||||||
|
|
||||||
|
|
||||||
# ccpo.add_new_ccpo_user
|
# ccpo.add_new_user
|
||||||
def test_ccpo_add_new_ccpo_user_access(get_url_assert_status):
|
def test_ccpo_add_new_user_access(get_url_assert_status):
|
||||||
ccpo = user_with(PermissionSets.MANAGE_CCPO_USERS)
|
ccpo = user_with(PermissionSets.MANAGE_CCPO_USERS)
|
||||||
rando = user_with()
|
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(ccpo, url, 200)
|
||||||
get_url_assert_status(rando, url, 404)
|
get_url_assert_status(rando, url, 404)
|
||||||
|
|
||||||
|
|
||||||
# ccpo.submit_add_new_ccpo_user
|
# ccpo.submit_new_user
|
||||||
def test_ccpo_submit_add_new_ccpo_user_access(post_url_assert_status):
|
def test_ccpo_submit_new_user_access(post_url_assert_status):
|
||||||
ccpo = user_with(PermissionSets.MANAGE_CCPO_USERS)
|
ccpo = user_with(PermissionSets.MANAGE_CCPO_USERS)
|
||||||
rando = user_with()
|
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(ccpo, url, 200, data={"dod_id": "1234567890"})
|
||||||
post_url_assert_status(rando, url, 404, data={"dod_id": "1234567890"})
|
post_url_assert_status(rando, url, 404, data={"dod_id": "1234567890"})
|
||||||
|
|
||||||
|
|
||||||
# ccpo.confirm_new_ccpo_user
|
# ccpo.confirm_new_user
|
||||||
def test_ccpo_confirm_new_ccpo_user_access(post_url_assert_status):
|
def test_ccpo_confirm_new_user_access(post_url_assert_status):
|
||||||
ccpo = user_with(PermissionSets.MANAGE_CCPO_USERS)
|
ccpo = user_with(PermissionSets.MANAGE_CCPO_USERS)
|
||||||
rando = user_with()
|
rando = user_with()
|
||||||
user = UserFactory.create()
|
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(ccpo, url, 302, data={"dod_id": user.dod_id})
|
||||||
post_url_assert_status(rando, url, 404, data={"dod_id": user.dod_id})
|
post_url_assert_status(rando, url, 404, data={"dod_id": user.dod_id})
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user