aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_relations.py
diff options
context:
space:
mode:
authorTom Christie2014-09-12 19:50:30 +0100
committerTom Christie2014-09-12 19:50:30 +0100
commit1f75ffc7912725e771a67bf3e6c3c6362dc3199a (patch)
tree93649e1e7ec59d1ab2bbc2374c4ad6bb96e66127 /tests/test_relations.py
parent0ac52e0808288892717c017e57c57aa8ad81e6d3 (diff)
downloaddjango-rest-framework-1f75ffc7912725e771a67bf3e6c3c6362dc3199a.tar.bz2
Access validation messages in a way thats compatible with 1.4, 1.5
Diffstat (limited to 'tests/test_relations.py')
-rw-r--r--tests/test_relations.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/test_relations.py b/tests/test_relations.py
index a3672117..c29618ce 100644
--- a/tests/test_relations.py
+++ b/tests/test_relations.py
@@ -32,13 +32,13 @@ class TestPrimaryKeyRelatedField(APISimpleTestCase):
def test_pk_related_lookup_does_not_exist(self):
with pytest.raises(ValidationError) as excinfo:
self.field.to_internal_value(4)
- msg = excinfo.value.message
+ msg = excinfo.value.messages[0]
assert msg == "Invalid pk '4' - object does not exist."
def test_pk_related_lookup_invalid_type(self):
with pytest.raises(ValidationError) as excinfo:
self.field.to_internal_value(BadType())
- msg = excinfo.value.message
+ msg = excinfo.value.messages[0]
assert msg == 'Incorrect type. Expected pk value, received BadType.'
def test_pk_representation(self):
@@ -122,13 +122,13 @@ class TestSlugRelatedField(APISimpleTestCase):
def test_slug_related_lookup_does_not_exist(self):
with pytest.raises(ValidationError) as excinfo:
self.field.to_internal_value('doesnotexist')
- msg = excinfo.value.message
+ msg = excinfo.value.messages[0]
assert msg == 'Object with name=doesnotexist does not exist.'
def test_slug_related_lookup_invalid_type(self):
with pytest.raises(ValidationError) as excinfo:
self.field.to_internal_value(BadType())
- msg = excinfo.value.message
+ msg = excinfo.value.messages[0]
assert msg == 'Invalid value.'
def test_representation(self):