Skip to content

Commit

Permalink
Rework CDSA audit urls for consistency with other apps
Browse files Browse the repository at this point in the history
  • Loading branch information
amstilp committed Feb 27, 2024
1 parent 66cbb7c commit 15ab60a
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 48 deletions.
2 changes: 1 addition & 1 deletion primed/cdsa/audit/signed_agreement_audit.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def __post_init__(self):
def get_action_url(self):
"""The URL that handles the action needed."""
return reverse(
"cdsa:signed_agreements:audit:resolve",
"cdsa:audit:signed_agreements:resolve",
args=[
self.signed_agreement,
],
Expand Down
2 changes: 1 addition & 1 deletion primed/cdsa/audit/workspace_audit.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def __post_init__(self):
def get_action_url(self):
"""The URL that handles the action needed."""
return reverse(
"cdsa:workspaces:audit:resolve",
"cdsa:audit:workspaces:resolve",
args=[
self.workspace.workspace.billing_project.name,
self.workspace.workspace.name,
Expand Down
22 changes: 11 additions & 11 deletions primed/cdsa/tests/test_audit.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def test_verified_access(self):
self.assertEqual(
instance.get_action_url(),
reverse(
"cdsa:signed_agreements:audit:resolve", args=[signed_agreement.cc_id]
"cdsa:audit:signed_agreements:resolve", args=[signed_agreement.cc_id]
),
)

Expand All @@ -50,7 +50,7 @@ def test_verified_no_access(self):
self.assertEqual(
instance.get_action_url(),
reverse(
"cdsa:signed_agreements:audit:resolve", args=[signed_agreement.cc_id]
"cdsa:audit:signed_agreements:resolve", args=[signed_agreement.cc_id]
),
)

Expand All @@ -64,7 +64,7 @@ def test_grant_access(self):
self.assertEqual(
instance.get_action_url(),
reverse(
"cdsa:signed_agreements:audit:resolve", args=[signed_agreement.cc_id]
"cdsa:audit:signed_agreements:resolve", args=[signed_agreement.cc_id]
),
)

Expand All @@ -78,7 +78,7 @@ def test_remove_access(self):
self.assertEqual(
instance.get_action_url(),
reverse(
"cdsa:signed_agreements:audit:resolve", args=[signed_agreement.cc_id]
"cdsa:audit:signed_agreements:resolve", args=[signed_agreement.cc_id]
),
)

Expand All @@ -91,7 +91,7 @@ def test_error(self):
self.assertEqual(
instance.get_action_url(),
reverse(
"cdsa:signed_agreements:audit:resolve", args=[signed_agreement.cc_id]
"cdsa:audit:signed_agreements:resolve", args=[signed_agreement.cc_id]
),
)

Expand Down Expand Up @@ -1441,7 +1441,7 @@ def test_verified_access(self):
self.assertEqual(
instance.get_action_url(),
reverse(
"cdsa:workspaces:audit:resolve",
"cdsa:audit:workspaces:resolve",
args=[
workspace.workspace.billing_project.name,
workspace.workspace.name,
Expand All @@ -1462,7 +1462,7 @@ def test_verified_no_access(self):
self.assertEqual(
instance.get_action_url(),
reverse(
"cdsa:workspaces:audit:resolve",
"cdsa:audit:workspaces:resolve",
args=[
workspace.workspace.billing_project.name,
workspace.workspace.name,
Expand All @@ -1483,7 +1483,7 @@ def test_grant_access(self):
self.assertEqual(
instance.get_action_url(),
reverse(
"cdsa:workspaces:audit:resolve",
"cdsa:audit:workspaces:resolve",
args=[
workspace.workspace.billing_project.name,
workspace.workspace.name,
Expand All @@ -1504,7 +1504,7 @@ def test_remove_access(self):
self.assertEqual(
instance.get_action_url(),
reverse(
"cdsa:workspaces:audit:resolve",
"cdsa:audit:workspaces:resolve",
args=[
workspace.workspace.billing_project.name,
workspace.workspace.name,
Expand All @@ -1525,7 +1525,7 @@ def test_error(self):
self.assertEqual(
instance.get_action_url(),
reverse(
"cdsa:workspaces:audit:resolve",
"cdsa:audit:workspaces:resolve",
args=[
workspace.workspace.billing_project.name,
workspace.workspace.name,
Expand All @@ -1542,7 +1542,7 @@ def test_error_no_data_affiliate_agreement(self):
self.assertEqual(
instance.get_action_url(),
reverse(
"cdsa:workspaces:audit:resolve",
"cdsa:audit:workspaces:resolve",
args=[
workspace.workspace.billing_project.name,
workspace.workspace.name,
Expand Down
16 changes: 8 additions & 8 deletions primed/cdsa/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ def test_links_for_staff_view(self):
self.client.force_login(user)
response = self.client.get(self.get_url())
self.assertContains(response, reverse("cdsa:agreement_versions:list"))
self.assertContains(response, reverse("cdsa:signed_agreements:audit:all"))
self.assertContains(response, reverse("cdsa:workspaces:audit:all"))
self.assertContains(response, reverse("cdsa:audit:signed_agreements:all"))
self.assertContains(response, reverse("cdsa:audit:workspaces:all"))
self.assertContains(response, reverse("cdsa:records:index"))
# Links to add CDSAs.
self.assertNotContains(response, reverse("cdsa:signed_agreements:members:new"))
Expand All @@ -95,8 +95,8 @@ def test_links_for_staff_edit(self):
self.client.force_login(user)
response = self.client.get(self.get_url())
self.assertContains(response, reverse("cdsa:agreement_versions:list"))
self.assertContains(response, reverse("cdsa:signed_agreements:audit:all"))
self.assertContains(response, reverse("cdsa:workspaces:audit:all"))
self.assertContains(response, reverse("cdsa:audit:signed_agreements:all"))
self.assertContains(response, reverse("cdsa:audit:workspaces:all"))
self.assertContains(response, reverse("cdsa:records:index"))
# Links to add CDSAs.
self.assertContains(response, reverse("cdsa:signed_agreements:members:new"))
Expand Down Expand Up @@ -5336,7 +5336,7 @@ def setUp(self):
def get_url(self, *args):
"""Get the url for the view being tested."""
return reverse(
"cdsa:signed_agreements:audit:all",
"cdsa:audit:signed_agreements:all",
args=args,
)

Expand Down Expand Up @@ -5520,7 +5520,7 @@ def setUp(self):

def get_url(self, *args):
"""Get the url for the view being tested."""
return reverse("cdsa:signed_agreements:audit:resolve", args=args)
return reverse("cdsa:audit:signed_agreements:resolve", args=args)

def get_view(self):
"""Return the view being tested."""
Expand Down Expand Up @@ -6064,7 +6064,7 @@ def setUp(self):
def get_url(self, *args):
"""Get the url for the view being tested."""
return reverse(
"cdsa:workspaces:audit:all",
"cdsa:audit:workspaces:all",
args=args,
)

Expand Down Expand Up @@ -6255,7 +6255,7 @@ def setUp(self):

def get_url(self, *args):
"""Get the url for the view being tested."""
return reverse("cdsa:workspaces:audit:resolve", args=args)
return reverse("cdsa:audit:workspaces:resolve", args=args)

def get_view(self):
"""Return the view being tested."""
Expand Down
41 changes: 20 additions & 21 deletions primed/cdsa/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,50 +80,49 @@
"non_data_affiliates",
)

signed_agreement_audit_patterns = (
[
path("", views.SignedAgreementAudit.as_view(), name="all"),
path(
"resolve/<int:cc_id>/",
views.SignedAgreementAuditResolve.as_view(),
name="resolve",
),
],
"audit",
)

signed_agreement_patterns = (
[
path("", views.SignedAgreementList.as_view(), name="list"),
path("members/", include(member_agreement_patterns)),
path("data_affiliates/", include(data_affiliate_agreement_patterns)),
path("non_data_affiliates/", include(non_data_affiliate_agreement_patterns)),
path("audit/", include(signed_agreement_audit_patterns)),
# path("audit/", include(signed_agreement_audit_patterns)),
],
"signed_agreements",
)

signed_agreement_audit_patterns = (
[
path("", views.SignedAgreementAudit.as_view(), name="all"),
path(
"<int:cc_id>/resolve/",
views.SignedAgreementAuditResolve.as_view(),
name="resolve",
),
],
"signed_agreements",
)

cdsa_workspace_audit_patterns = (
workspace_audit_patterns = (
[
path("", views.CDSAWorkspaceAudit.as_view(), name="all"),
path(
"resolve/<slug:billing_project_slug>/<slug:workspace_slug>/",
"<slug:billing_project_slug>/<slug:workspace_slug>/resolve/",
views.CDSAWorkspaceAuditResolve.as_view(),
name="resolve",
),
],
"audit",
"workspaces",
)

cdsa_workspace_patterns = (
audit_patterns = (
[
path("audit/", include(cdsa_workspace_audit_patterns)),
path("workspaces", include(workspace_audit_patterns)),
path("signed_agreements", include(signed_agreement_audit_patterns)),
],
"workspaces",
"audit",
)


records_patterns = (
[
path("", views.RecordsIndex.as_view(), name="index"),
Expand Down Expand Up @@ -156,5 +155,5 @@
path("agreement_versions/", include(agreement_version_patterns)),
path("signed_agreements/", include(signed_agreement_patterns)),
path("records/", include(records_patterns)),
path("cdsa_workspaces/", include(cdsa_workspace_patterns)),
path("audit/", include(audit_patterns)),
]
4 changes: 2 additions & 2 deletions primed/templates/cdsa/nav_items.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@
{% endif %}

<li>
<a class="dropdown-item" href="{% url 'cdsa:signed_agreements:audit:all'%}">Audit signed agreements</a>
<a class="dropdown-item" href="{% url 'cdsa:audit:signed_agreements:all'%}">Audit signed agreements</a>
</li>
<li>
<a class="dropdown-item" href="{% url 'cdsa:workspaces:audit:all'%}">Audit workspaces</a>
<a class="dropdown-item" href="{% url 'cdsa:audit:workspaces:all'%}">Audit workspaces</a>
</li>

<li><hr class="dropdown-divider"></li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
{% if record.action %}
<form
method="post"
action="{% url 'cdsa:signed_agreements:audit:resolve' record.signed_agreement.cc_id %}">
action="{% url 'cdsa:audit:signed_agreements:resolve' record.signed_agreement.cc_id %}">

{% csrf_token %}
<button
type="submit"
class="btn btn-primary btn-sm"
hx-post="{% url 'cdsa:signed_agreements:audit:resolve' record.signed_agreement.cc_id %}"
hx-post="{% url 'cdsa:audit:signed_agreements:resolve' record.signed_agreement.cc_id %}"
hx-disabled-elt="this"
hx-target="closest div"
hx-swap="innerHTML">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
{% if record.action %}
<form
method="post"
action="{% url 'cdsa:workspaces:audit:resolve' record.workspace.workspace.billing_project.name record.workspace.workspace.name %}">
action="{% url 'cdsa:audit:workspaces:resolve' record.workspace.workspace.billing_project.name record.workspace.workspace.name %}">

{% csrf_token %}
<button
type="submit"
class="btn btn-primary btn-sm"
hx-post="{% url 'cdsa:workspaces:audit:resolve' record.workspace.workspace.billing_project.name record.workspace.workspace.name %}"
hx-post="{% url 'cdsa:audit:workspaces:resolve' record.workspace.workspace.billing_project.name record.workspace.workspace.name %}"
hx-disabled-elt="this"
hx-target="closest div"
hx-swap="innerHTML">
Expand Down

0 comments on commit 15ab60a

Please sign in to comment.