Skip to content

Commit

Permalink
Adjust query tests to assert correctly
Browse files Browse the repository at this point in the history
The data sent to the requestor is not a simple json.dumps, so we must
use the `.to_json()` utility included on each Resource object when
making assertions
  • Loading branch information
bartek committed Feb 8, 2017
1 parent b1e4d01 commit 27e3c16
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests/test_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ def test_create_object(self, mock_request):
r = MockResource(data, client=self.client)
r.save()
mock_request.assert_called_once_with(
'/mocks', 'POST', data=json.dumps(data))
'/mocks', 'POST', data=r.to_json())

def test_update_object(self, mock_request):
data = {
Expand All @@ -318,7 +318,7 @@ def test_update_object(self, mock_request):
data['first_name'] = 'Jonathan'

mock_request.assert_called_once_with(
'/mocks/1', 'PUT', data=json.dumps(data))
'/mocks/1', 'PUT', data=r.to_json())

def test_partial_update_object(self, mock_request):
data = {
Expand Down

0 comments on commit 27e3c16

Please sign in to comment.