Add a test to reproduce the bug reported by Endre Karlson
This commit is contained in:
parent
9ee2d2f9a2
commit
d71b762ae3
@ -80,3 +80,8 @@ class AuthorsController(RestController):
|
|||||||
)
|
)
|
||||||
]
|
]
|
||||||
return author
|
return author
|
||||||
|
|
||||||
|
@wsmeext.pecan.wsexpose(Author, body=Author)
|
||||||
|
def post(self, author):
|
||||||
|
author.id = 10
|
||||||
|
return author
|
||||||
|
@ -57,6 +57,16 @@ class TestWS(FunctionalTest):
|
|||||||
assert '<id>1</id>' in a.body
|
assert '<id>1</id>' in a.body
|
||||||
assert '<firstname>aname</firstname>' in a.body
|
assert '<firstname>aname</firstname>' in a.body
|
||||||
|
|
||||||
|
def test_post_body_parameter(self):
|
||||||
|
res = self.app.post(
|
||||||
|
'/authors', '{"firstname": "test"}',
|
||||||
|
headers={"Content-Type": "application/json"}
|
||||||
|
)
|
||||||
|
a = json.loads(res.body)
|
||||||
|
print a
|
||||||
|
assert a['id'] == 10
|
||||||
|
assert a['firstname'] == 'test'
|
||||||
|
|
||||||
def test_clientsideerror(self):
|
def test_clientsideerror(self):
|
||||||
res = self.app.get(
|
res = self.app.get(
|
||||||
'/authors/999.json',
|
'/authors/999.json',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user