File tree Expand file tree Collapse file tree 4 files changed +34
-7
lines changed Expand file tree Collapse file tree 4 files changed +34
-7
lines changed Original file line number Diff line number Diff line change 44
55import pytz
66from django .core .urlresolvers import reverse
7+ from rest_framework .exceptions import ErrorDetail
78
89from sentry .app import locks
910from 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
595598class ReleaseSerializerTest (unittest .TestCase ):
Original file line number Diff line number Diff line change 33import pytz
44from django .utils import timezone
55from django .core .urlresolvers import reverse
6+ from rest_framework .exceptions import ErrorDetail
67from exam import fixture
78
89from 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
Original file line number Diff line number Diff line change 11from rest_framework import serializers
2+ from rest_framework .exceptions import ErrorDetail
23
34from sentry .testutils import TestCase
4-
55from sentry .api .serializers .rest_framework import ListField , ActorField
66from 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
4450class TestActorField (TestCase ):
Original file line number Diff line number Diff line change 11from sentry .utils .compat .mock import patch
22from uuid import uuid4
33
4+ from rest_framework .exceptions import ErrorDetail
5+
46from sentry import tagstore
57from sentry .api .endpoints .organization_releases import ReleaseSerializerWithProjects
68from 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 = {
You can’t perform that action at this time.
0 commit comments