diff --git a/umap/tests/test_map_views.py b/umap/tests/test_map_views.py index 5266f0cd..7a8f2f49 100644 --- a/umap/tests/test_map_views.py +++ b/umap/tests/test_map_views.py @@ -557,3 +557,15 @@ def test_anonymous_cannot_star_map(client, map): assert response.status_code == 302 assert "login" in response["Location"] assert Star.objects.count() == 0 + + +def test_user_can_see_their_star(client, map, user): + url = reverse('map_star', args=(map.pk,)) + client.login(username=user.username, password="123123") + assert Star.objects.filter(by=user).count() == 0 + response = client.post(url) + assert response.status_code == 200 + url = reverse('user_stars', args=(user.username,)) + response = client.get(url) + assert response.status_code == 200 + assert map.name in response.content.decode() diff --git a/umap/urls.py b/umap/urls.py index 58beb6a4..1c35bdb7 100644 --- a/umap/urls.py +++ b/umap/urls.py @@ -151,8 +151,8 @@ urlpatterns += i18n_patterns( ), re_path(r"^search/$", views.search, name="search"), re_path(r"^about/$", views.about, name="about"), + re_path(r"^user/(?P.+)/stars/$", views.user_stars, name='user_stars'), re_path(r"^user/(?P.+)/$", views.user_maps, name="user_maps"), - re_path(r'^user/(?P[-_\w@]+)/stars/$', views.user_stars, name='user_stars'), re_path(r"", include(i18n_urls)), )