Skip to content

Commit

Permalink
adding tests and removing dropdown
Browse files Browse the repository at this point in the history
  • Loading branch information
Sahil590 committed Oct 9, 2024
1 parent 9cee3c9 commit ac2a802
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
20 changes: 5 additions & 15 deletions main/templates/main/navbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,13 @@
</ul>
<ul class="navbar-nav">
{% if user.is_authenticated %}
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle"
href="#"
id="navbarDropdownMenuLink"
role="button"
data-bs-toggle="dropdown"
aria-expanded="false">{{ user.username }}</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
<li>
<a class="dropdown-item" href="{% url 'main:logout' %}">Logout</a>
</li>
</ul>
<li class="nav-item">
<a class="nav-link">Welcome: {{ user.username }}</a>
</li>
<li class="nav-item">
<a class="nav-link" href="{% url 'main:help' %}">Help</a>
</li>
{% endif %}
<li class="nav-item">
<a class="nav-link" href="{% url 'main:help' %}">Help</a>
</li>
</ul>
</div>
</div>
Expand Down
8 changes: 8 additions & 0 deletions tests/main/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,11 @@ def test_index_view_authenticated(self, auth_client):
response,
f'<a href="{reverse("controller:index")}" class="btn btn-secondary">Controller</a>', # noqa: E501
)

def test_help_view(self, auth_client):
"""Test that the help view is rendered."""
response = auth_client.get(reverse("main:help"))
assert response.status_code == HTTPStatus.OK
assertTemplateUsed(response, "main/help.html")
assertContains(response, "<h1>Help</h1>")
assertContains(response, "This is the help page.")

0 comments on commit ac2a802

Please sign in to comment.