Ratings: implement replies by maintainers #181
@ -163,3 +163,18 @@ class AddRatingViewTest(TestCase):
|
||||
rating = Rating.objects.first()
|
||||
self.assertEqual(rating.score, 3)
|
||||
self.assertEqual(rating.text, text)
|
||||
|
||||
def test_reply(self):
|
||||
version = create_approved_version(ratings=[])
|
||||
rating = RatingFactory(version=version, text='some text', status=Rating.STATUSES.APPROVED)
|
||||
|
||||
random_user = UserFactory()
|
||||
self.client.force_login(random_user)
|
||||
response = self.client.post(rating.get_reply_url(), {'text': 'some reply'})
|
||||
self.assertEqual(response.status_code, 403)
|
||||
|
||||
self.client.force_login(version.extension.authors.first())
|
||||
response = self.client.post(rating.get_reply_url(), {'text': 'some reply'})
|
||||
self.assertEqual(response.status_code, 302)
|
||||
rating.refresh_from_db()
|
||||
self.assertTrue(hasattr(rating, 'ratingreply'))
|
||||
|
Loading…
Reference in New Issue
Block a user