@@ -24,8 +24,7 @@ def test_no_auth_is_used_by_default(self):
2424        self .assertEquals (session .auth , None )
2525        session .request ('get' , '/test' )
2626        self .requests_mock .request .assert_called_with (
27-             'get' , 'https://example.org/test' ,
28-             json = {'data' : {}})
27+             'get' , 'https://example.org/test' )
2928
3029    def  test_bad_http_status_raises_exception (self ):
3130        response  =  mock .MagicMock ()
@@ -44,8 +43,7 @@ def test_session_injects_auth_on_requests(self):
4443        session .request ('get' , '/test' )
4544        self .requests_mock .request .assert_called_with (
4645            'get' , 'https://example.org/test' ,
47-             auth = mock .sentinel .auth ,
48-             json = {"data" : {}})
46+             auth = mock .sentinel .auth )
4947
5048    def  test_requests_arguments_are_forwarded (self ):
5149        response  =  mock .MagicMock ()
@@ -56,18 +54,17 @@ def test_requests_arguments_are_forwarded(self):
5654                        foo = mock .sentinel .bar )
5755        self .requests_mock .request .assert_called_with (
5856            'get' , 'https://example.org/test' ,
59-             foo = mock .sentinel .bar ,
60-             json = {"data" : {}})
57+             foo = mock .sentinel .bar )
6158
6259    def  test_passed_data_is_encoded_to_json (self ):
6360        response  =  mock .MagicMock ()
6461        response .status_code  =  200 
6562        self .requests_mock .request .return_value  =  response 
6663        session  =  Session ('https://example.org' )
67-         session .request ('get ' , '/test' ,
64+         session .request ('post ' , '/test' ,
6865                        data = {'foo' : 'bar' })
6966        self .requests_mock .request .assert_called_with (
70-             'get ' , 'https://example.org/test' ,
67+             'post ' , 'https://example.org/test' ,
7168            json = {"data" : {'foo' : 'bar' }})
7269
7370    def  test_passed_data_is_passed_as_is_when_files_are_posted (self ):
@@ -90,10 +87,10 @@ def test_passed_permissions_is_added_in_the_payload(self):
9087        session  =  Session ('https://example.org' )
9188        permissions  =  mock .MagicMock ()
9289        permissions .as_dict .return_value  =  {'foo' : 'bar' }
93-         session .request ('get ' , '/test' ,
90+         session .request ('post ' , '/test' ,
9491                        permissions = permissions )
9592        self .requests_mock .request .assert_called_with (
96-             'get ' , 'https://example.org/test' ,
93+             'post ' , 'https://example.org/test' ,
9794            json = {'data' : {}, 'permissions' : {'foo' : 'bar' }})
9895
9996    def  test_url_is_used_if_schema_is_present (self ):
@@ -105,8 +102,7 @@ def test_url_is_used_if_schema_is_present(self):
105102        permissions .as_dict .return_value  =  {'foo' : 'bar' }
106103        session .request ('get' , 'https://example.org/anothertest' )
107104        self .requests_mock .request .assert_called_with (
108-             'get' , 'https://example.org/anothertest' ,
109-             json = {"data" : {}})
105+             'get' , 'https://example.org/anothertest' )
110106
111107    def  test_creation_fails_if_session_and_server_url (self ):
112108        self .assertRaises (
@@ -142,6 +138,25 @@ def test_body_is_none_on_304(self):
142138        body , headers  =  session .request ('get' , 'https://example.org/test' )
143139        assert  body  is  None 
144140
141+     def  test_no_payload_is_sent_on_get_requests (self ):
142+         response  =  mock .MagicMock ()
143+         response .status_code  =  200 
144+         self .requests_mock .request .return_value  =  response 
145+         session  =  Session ('https://example.org' )
146+         session .request ('get' , 'https://example.org/anothertest' )
147+         self .requests_mock .request .assert_called_with (
148+             'get' , 'https://example.org/anothertest' )
149+ 
150+     def  test_payload_is_sent_on_put_requests (self ):
151+         response  =  mock .MagicMock ()
152+         response .status_code  =  200 
153+         self .requests_mock .request .return_value  =  response 
154+         session  =  Session ('https://example.org' )
155+         session .request ('put' , 'https://example.org/anothertest' )
156+         self .requests_mock .request .assert_called_with (
157+             'put' , 'https://example.org/anothertest' ,
158+             json = {'data' : {}})
159+ 
145160
146161class  RetryRequestTest (unittest .TestCase ):
147162
0 commit comments