Skip to content

Commit 907e07e

Browse files
committed
1 parent 0b971ee commit 907e07e

File tree

4 files changed

+34
-7
lines changed

4 files changed

+34
-7
lines changed

tests/sentry/api/endpoints/test_organization_release_details.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import pytz
66
from django.core.urlresolvers import reverse
7+
from rest_framework.exceptions import ErrorDetail
78

89
from sentry.app import locks
910
from sentry.constants import MAX_VERSION_LENGTH
@@ -589,7 +590,9 @@ def test_bad_commit_list(self):
589590
},
590591
)
591592
assert response.status_code == 400
592-
assert response.data == {"commits": {"id": ["This field is required."]}}
593+
assert response.data == {
594+
"commits": {0: {"id": [ErrorDetail(string="This field is required.", code="required")]}}
595+
}
593596

594597

595598
class ReleaseSerializerTest(unittest.TestCase):

tests/sentry/api/endpoints/test_project_releases.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import pytz
44
from django.utils import timezone
55
from django.core.urlresolvers import reverse
6+
from rest_framework.exceptions import ErrorDetail
67
from exam import fixture
78

89
from sentry.api.endpoints.project_releases import ReleaseWithVersionSerializer
@@ -593,8 +594,21 @@ def test_invalid_patch_type(self):
593594
)
594595

595596
assert response.status_code == 400
596-
assert dict(response.data) == {
597-
"commits": {"patch_set": {"type": ["Commit patch_set type Z is not supported."]}}
597+
assert response.data == {
598+
"commits": {
599+
0: {
600+
"patch_set": {
601+
0: {
602+
"type": [
603+
ErrorDetail(
604+
string="Commit patch_set type Z is not supported.",
605+
code="invalid",
606+
)
607+
]
608+
}
609+
}
610+
}
611+
}
598612
}
599613

600614

tests/sentry/api/serializers/test_fields.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from rest_framework import serializers
2+
from rest_framework.exceptions import ErrorDetail
23

34
from sentry.testutils import TestCase
4-
55
from sentry.api.serializers.rest_framework import ListField, ActorField
66
from sentry.models import User, Team
77

@@ -31,14 +31,20 @@ def test_allow_null(self):
3131

3232
serializer = DummySerializer(data=data)
3333
assert not serializer.is_valid()
34-
assert serializer.errors == {"a_field": ["This field may not be null."]}
34+
assert serializer.errors == {
35+
"a_field": {0: [ErrorDetail(string="This field may not be null.", code="null")]}
36+
}
3537

3638
def test_child_validates(self):
3739
data = {"a_field": [{"b_field": "abcdefg"}]}
3840

3941
serializer = DummySerializer(data=data)
4042
assert not serializer.is_valid()
41-
assert serializer.errors == {"a_field": {"d_field": ["This field is required."]}}
43+
assert serializer.errors == {
44+
"a_field": {
45+
0: {"d_field": [ErrorDetail(string="This field is required.", code="required")]}
46+
}
47+
}
4248

4349

4450
class TestActorField(TestCase):

tests/sentry/api/serializers/test_release.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
from sentry.utils.compat.mock import patch
22
from uuid import uuid4
33

4+
from rest_framework.exceptions import ErrorDetail
5+
46
from sentry import tagstore
57
from sentry.api.endpoints.organization_releases import ReleaseSerializerWithProjects
68
from sentry.api.serializers import serialize
@@ -464,7 +466,9 @@ def test_simple(self):
464466
serializer = ReleaseSerializerWithProjects(data=data)
465467

466468
assert not serializer.is_valid()
467-
assert serializer.errors == {"refs": ["This field may not be null."]}
469+
assert serializer.errors == {
470+
"refs": {0: [ErrorDetail("This field may not be null.", code="null")]}
471+
}
468472

469473
# test good refs
470474
data = {

0 commit comments

Comments
 (0)