Skip to content

Test a view with a JSONfield: 415 Unsupported Media Type #7863

Discussion options

You must be logged in to vote

Well... without the dumps it actually works as expected

class TestInstanceUpdate(BaseTestRequest):

    def setUp(self):
        super(TestInstanceUpdate, self).setUp()
        self.url = reverse('api_admin_instance_details', args=[self.test_instance.id])

        self.update_data = {
            "name": "new_name",
            "spec": {
                "key1": "value1",
                "key2": "value2"
            }
        }

    def test_update_instance(self):
        response = self.client.put(self.url, data=self.update_data, content_type="application/json")
        self.assertEqual(response.status_code, status.HTTP_200_OK)
        self.test_instance.refresh_from_db()
        expected =

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Sispheor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant