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,
|
allow_null=False,
|
||||||
required=True,
|
required=True,
|
||||||
allow_blank=False,
|
allow_blank=False,
|
||||||
validators=[NoURLsValidator()],
|
|
||||||
)
|
)
|
||||||
|
|
||||||
def to_representation(self, obj):
|
def to_representation(self, obj):
|
||||||
|
|
|
@ -3034,6 +3034,25 @@ class TestRatingViewSetReply(TestCase):
|
||||||
|
|
||||||
assert len(mail.outbox) == 1
|
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):
|
def test_reply_if_a_reply_already_exists_updates_existing(self):
|
||||||
self.addon_author = user_factory()
|
self.addon_author = user_factory()
|
||||||
self.addon.addonuser_set.create(user=self.addon_author)
|
self.addon.addonuser_set.create(user=self.addon_author)
|
||||||
|
|
Загрузка…
Ссылка в новой задаче