When trying to test apis that are decorated with @api_view
I receive a format that does not match to the response when testing it manually. I expect the following format:
{
"field": "string value"
}
but when I try to post(from tests) I receive error because the format appears to be this one:
{
"field": ["string_value"]
}
To reproduce this problem:
class Tests(rest_framework.test.APITestCase):
def test_api(self):
...
response = self.client.post(url, data)
...
Aucun commentaire:
Enregistrer un commentaire