Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
django-rest-framework
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
django-rest-framework
Commits
7f8d3141
Commit
7f8d3141
authored
Jan 08, 2015
by
Craig Blaszczyk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update tests to expect new error messages
parent
1368c31a
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
11 deletions
+11
-11
tests/test_fields.py
+9
-9
tests/test_serializer_bulk_update.py
+2
-2
No files found.
tests/test_fields.py
View file @
7f8d3141
...
@@ -338,7 +338,7 @@ class TestBooleanField(FieldValues):
...
@@ -338,7 +338,7 @@ class TestBooleanField(FieldValues):
False
:
False
,
False
:
False
,
}
}
invalid_inputs
=
{
invalid_inputs
=
{
'foo'
:
[
'
`foo`
is not a valid boolean.'
],
'foo'
:
[
'
"foo"
is not a valid boolean.'
],
None
:
[
'This field may not be null.'
]
None
:
[
'This field may not be null.'
]
}
}
outputs
=
{
outputs
=
{
...
@@ -368,7 +368,7 @@ class TestNullBooleanField(FieldValues):
...
@@ -368,7 +368,7 @@ class TestNullBooleanField(FieldValues):
None
:
None
None
:
None
}
}
invalid_inputs
=
{
invalid_inputs
=
{
'foo'
:
[
'
`foo`
is not a valid boolean.'
],
'foo'
:
[
'
"foo"
is not a valid boolean.'
],
}
}
outputs
=
{
outputs
=
{
'true'
:
True
,
'true'
:
True
,
...
@@ -832,7 +832,7 @@ class TestChoiceField(FieldValues):
...
@@ -832,7 +832,7 @@ class TestChoiceField(FieldValues):
'good'
:
'good'
,
'good'
:
'good'
,
}
}
invalid_inputs
=
{
invalid_inputs
=
{
'amazing'
:
[
'
`amazing`
is not a valid choice.'
]
'amazing'
:
[
'
"amazing"
is not a valid choice.'
]
}
}
outputs
=
{
outputs
=
{
'good'
:
'good'
,
'good'
:
'good'
,
...
@@ -872,8 +872,8 @@ class TestChoiceFieldWithType(FieldValues):
...
@@ -872,8 +872,8 @@ class TestChoiceFieldWithType(FieldValues):
3
:
3
,
3
:
3
,
}
}
invalid_inputs
=
{
invalid_inputs
=
{
5
:
[
'
`5`
is not a valid choice.'
],
5
:
[
'
"5"
is not a valid choice.'
],
'abc'
:
[
'
`abc`
is not a valid choice.'
]
'abc'
:
[
'
"abc"
is not a valid choice.'
]
}
}
outputs
=
{
outputs
=
{
'1'
:
1
,
'1'
:
1
,
...
@@ -899,7 +899,7 @@ class TestChoiceFieldWithListChoices(FieldValues):
...
@@ -899,7 +899,7 @@ class TestChoiceFieldWithListChoices(FieldValues):
'good'
:
'good'
,
'good'
:
'good'
,
}
}
invalid_inputs
=
{
invalid_inputs
=
{
'awful'
:
[
'
`awful`
is not a valid choice.'
]
'awful'
:
[
'
"awful"
is not a valid choice.'
]
}
}
outputs
=
{
outputs
=
{
'good'
:
'good'
'good'
:
'good'
...
@@ -917,8 +917,8 @@ class TestMultipleChoiceField(FieldValues):
...
@@ -917,8 +917,8 @@ class TestMultipleChoiceField(FieldValues):
(
'aircon'
,
'manual'
):
set
([
'aircon'
,
'manual'
]),
(
'aircon'
,
'manual'
):
set
([
'aircon'
,
'manual'
]),
}
}
invalid_inputs
=
{
invalid_inputs
=
{
'abc'
:
[
'Expected a list of items but got type
`str`
.'
],
'abc'
:
[
'Expected a list of items but got type
"str"
.'
],
(
'aircon'
,
'incorrect'
):
[
'
`incorrect`
is not a valid choice.'
]
(
'aircon'
,
'incorrect'
):
[
'
"incorrect"
is not a valid choice.'
]
}
}
outputs
=
[
outputs
=
[
([
'aircon'
,
'manual'
],
set
([
'aircon'
,
'manual'
]))
([
'aircon'
,
'manual'
],
set
([
'aircon'
,
'manual'
]))
...
@@ -1028,7 +1028,7 @@ class TestListField(FieldValues):
...
@@ -1028,7 +1028,7 @@ class TestListField(FieldValues):
([
'1'
,
'2'
,
'3'
],
[
1
,
2
,
3
])
([
'1'
,
'2'
,
'3'
],
[
1
,
2
,
3
])
]
]
invalid_inputs
=
[
invalid_inputs
=
[
(
'not a list'
,
[
'Expected a list of items but got type
`str`
.'
]),
(
'not a list'
,
[
'Expected a list of items but got type
"str"
.'
]),
([
1
,
2
,
'error'
],
[
'A valid integer is required.'
])
([
1
,
2
,
'error'
],
[
'A valid integer is required.'
])
]
]
outputs
=
[
outputs
=
[
...
...
tests/test_serializer_bulk_update.py
View file @
7f8d3141
...
@@ -101,7 +101,7 @@ class BulkCreateSerializerTests(TestCase):
...
@@ -101,7 +101,7 @@ class BulkCreateSerializerTests(TestCase):
serializer
=
self
.
BookSerializer
(
data
=
data
,
many
=
True
)
serializer
=
self
.
BookSerializer
(
data
=
data
,
many
=
True
)
self
.
assertEqual
(
serializer
.
is_valid
(),
False
)
self
.
assertEqual
(
serializer
.
is_valid
(),
False
)
expected_errors
=
{
'non_field_errors'
:
[
'Expected a list of items but got type
`int`
.'
]}
expected_errors
=
{
'non_field_errors'
:
[
'Expected a list of items but got type
"int"
.'
]}
self
.
assertEqual
(
serializer
.
errors
,
expected_errors
)
self
.
assertEqual
(
serializer
.
errors
,
expected_errors
)
...
@@ -118,6 +118,6 @@ class BulkCreateSerializerTests(TestCase):
...
@@ -118,6 +118,6 @@ class BulkCreateSerializerTests(TestCase):
serializer
=
self
.
BookSerializer
(
data
=
data
,
many
=
True
)
serializer
=
self
.
BookSerializer
(
data
=
data
,
many
=
True
)
self
.
assertEqual
(
serializer
.
is_valid
(),
False
)
self
.
assertEqual
(
serializer
.
is_valid
(),
False
)
expected_errors
=
{
'non_field_errors'
:
[
'Expected a list of items but got type
`dict`
.'
]}
expected_errors
=
{
'non_field_errors'
:
[
'Expected a list of items but got type
"dict"
.'
]}
self
.
assertEqual
(
serializer
.
errors
,
expected_errors
)
self
.
assertEqual
(
serializer
.
errors
,
expected_errors
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment