Allow URLs in developer replies to ratings (#22749)
This commit is contained in:
Родитель
ed750ffd35
Коммит
a26bf8131b
|
@ -184,7 +184,6 @@ class RatingSerializerReply(BaseRatingSerializer):
|
|||
allow_null=False,
|
||||
required=True,
|
||||
allow_blank=False,
|
||||
validators=[NoURLsValidator()],
|
||||
)
|
||||
|
||||
def to_representation(self, obj):
|
||||
|
|
|
@ -3034,6 +3034,25 @@ class TestRatingViewSetReply(TestCase):
|
|||
|
||||
assert len(mail.outbox) == 1
|
||||
|
||||
def test_reply_allows_urls(self):
|
||||
self.addon_author = user_factory()
|
||||
self.addon.addonuser_set.create(user=self.addon_author)
|
||||
self.client.login_api(self.addon_author)
|
||||
response = self.client.post(
|
||||
self.url,
|
||||
data={
|
||||
'body': 'My réply... https://example.com is nice.',
|
||||
},
|
||||
)
|
||||
assert response.status_code == 201
|
||||
review = Rating.objects.latest('pk')
|
||||
assert review.pk == response.data['id']
|
||||
assert (
|
||||
review.body
|
||||
== response.data['body']
|
||||
== 'My réply... https://example.com is nice.'
|
||||
)
|
||||
|
||||
def test_reply_if_a_reply_already_exists_updates_existing(self):
|
||||
self.addon_author = user_factory()
|
||||
self.addon.addonuser_set.create(user=self.addon_author)
|
||||
|
|
Загрузка…
Ссылка в новой задаче