Fix url order for retrieving user stars
Since that initial PR, the username regex has been more gready.
This commit is contained in:
parent
30f9612a12
commit
40f40038f8
2 changed files with 13 additions and 1 deletions
|
@ -557,3 +557,15 @@ def test_anonymous_cannot_star_map(client, map):
|
||||||
assert response.status_code == 302
|
assert response.status_code == 302
|
||||||
assert "login" in response["Location"]
|
assert "login" in response["Location"]
|
||||||
assert Star.objects.count() == 0
|
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()
|
||||||
|
|
|
@ -151,8 +151,8 @@ urlpatterns += i18n_patterns(
|
||||||
),
|
),
|
||||||
re_path(r"^search/$", views.search, name="search"),
|
re_path(r"^search/$", views.search, name="search"),
|
||||||
re_path(r"^about/$", views.about, name="about"),
|
re_path(r"^about/$", views.about, name="about"),
|
||||||
|
re_path(r"^user/(?P<username>.+)/stars/$", views.user_stars, name='user_stars'),
|
||||||
re_path(r"^user/(?P<username>.+)/$", views.user_maps, name="user_maps"),
|
re_path(r"^user/(?P<username>.+)/$", views.user_maps, name="user_maps"),
|
||||||
re_path(r'^user/(?P<username>[-_\w@]+)/stars/$', views.user_stars, name='user_stars'),
|
|
||||||
re_path(r"", include(i18n_urls)),
|
re_path(r"", include(i18n_urls)),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue