From 1371d6a3e60efa097b3464a784e8587219c64509 Mon Sep 17 00:00:00 2001 From: Arnav Choudhury Date: Thu, 4 Mar 2021 19:34:58 +0530 Subject: [PATCH] Reverting the use of get_absolute_url method in getting the detail view url. Purpose was to test if the url could be created correctly and not if the view was working correctly. --- .../{{cookiecutter.project_slug}}/users/tests/test_urls.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_urls.py b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_urls.py index 2623f4e3..aab6d0a8 100644 --- a/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_urls.py +++ b/{{cookiecutter.project_slug}}/{{cookiecutter.project_slug}}/users/tests/test_urls.py @@ -7,7 +7,10 @@ pytestmark = pytest.mark.django_db def test_detail(user: User): - assert user.get_absolute_url() == f"/users/{user.username}/" + assert ( + reverse("users:detail", kwargs={"username": user.username}) + == f"/users/{user.username}/" + ) assert resolve(f"/users/{user.username}/").view_name == "users:detail"