1👍
✅
You’re receiving that error because your not sending JSON data, What your sending is form-data, Here is how to fix it:
def test_url(self):
json_data = {
"model": "X5",
"version": "LT",
...
}
response = self.guest_client.post('/add_robot/',
data= json.dumps(json_data),
content_type='application/json')
Using json.dumps will convert the python dictionary to JSON string and with setting the content_type as application/json you’re specifying the format you’re sending.
Source:stackexchange.com