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.

This commit is contained in:
Arnav Choudhury 2021-03-04 19:34:58 +05:30
parent fa0b278225
commit 1371d6a3e6

View File

@ -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"