Start to use the media_id in "admin" URLs.
We have a bunch of URLs that are more for internal use. At least they're definitely not intended to be posted somewhere for long term useage. When those things affect a media, it's much better to reference the media by its id. This can't change, ever. This is better for races. Like someone posting a comment while the owner corrects a typo in the slug.
This commit is contained in:
@@ -161,11 +161,17 @@ class TestSubmission:
|
||||
media = self.check_media(request, {'title': u'Balanced Goblin'}, 1)
|
||||
media_id = media.id
|
||||
|
||||
# At least render the edit page
|
||||
edit_url = request.urlgen(
|
||||
'mediagoblin.edit.edit_media',
|
||||
user=self.test_user.username, media_id=media_id)
|
||||
self.test_app.get(edit_url)
|
||||
|
||||
# Add a comment, so we can test for its deletion later.
|
||||
self.check_comments(request, media_id, 0)
|
||||
comment_url = request.urlgen(
|
||||
'mediagoblin.user_pages.media_post_comment',
|
||||
user=self.test_user.username, media=media_id)
|
||||
user=self.test_user.username, media_id=media_id)
|
||||
response = self.do_post({'comment_content': 'i love this test'},
|
||||
url=comment_url, do_follow=True)[0]
|
||||
self.check_comments(request, media_id, 1)
|
||||
@@ -174,7 +180,7 @@ class TestSubmission:
|
||||
# ---------------------------------------------------
|
||||
delete_url = request.urlgen(
|
||||
'mediagoblin.user_pages.media_confirm_delete',
|
||||
user=self.test_user.username, media=media_id)
|
||||
user=self.test_user.username, media_id=media_id)
|
||||
# Empty data means don't confirm
|
||||
response = self.do_post({}, do_follow=True, url=delete_url)[0]
|
||||
media = self.check_media(request, {'title': u'Balanced Goblin'}, 1)
|
||||
|
||||
Reference in New Issue
Block a user