示例#1
0
 def test_delete_called_with(self, delete_request, create_session):
     library = APILibrary()
     library.call_delete_request({"a": "Text"}, "Endpoint", "fullstring")
     delete_request.assert_called_with("deleteapi",
                                       "fullstring",
                                       None,
                                       timeout=None)
     create_session.assert_called_with("deleteapi",
                                       "Endpoint", {"a": "Text"},
                                       cookies=None,
                                       timeout=None)
示例#2
0
 def test_delete_with_cookies(self, delete_on_session, create_session):
     library = APILibrary()
     library.call_delete_request({"a": "Text"}, "Endpoint", "fullstring",
                                 None, "chocolate_chip")
     delete_on_session.assert_called_with("deleteapi",
                                          "fullstring",
                                          timeout='chocolate_chip',
                                          expected_status='any')
     create_session.assert_called_with("deleteapi",
                                       "Endpoint", {"a": "Text"},
                                       cookies=None,
                                       timeout='chocolate_chip')
示例#3
0
 def test_delete_insecure_request(self, disable_warnings, delete_request,
                                  create_session):
     library = APILibrary()
     library.suppress_insecure_request_warnings()
     library.call_delete_request({"a": "Text"}, "Endpoint", "fullstring")
     disable_warnings.assert_called()
     create_session.assert_called_with('deleteapi',
                                       'Endpoint', {'a': 'Text'},
                                       cookies=None,
                                       timeout=None)
     delete_request.assert_called_with('deleteapi',
                                       'fullstring',
                                       None,
                                       timeout=None)
示例#4
0
 def test_basic_delete(self, create_session, delete_request):
     library = APILibrary()
     r = library.call_delete_request({"a": "Text"}, "Endpoint",
                                     "fullstring")
     type(r).text = PropertyMock(return_value="success")
     type(r).status_code = PropertyMock(return_value=200)
     assert r.text == "success"
     assert r.status_code == 200
示例#5
0
 def test_basic_delete(self, create_session, delete_request):
     library = APILibrary()
     r = library.call_delete_request({"a": "Text"}, "Endpoint",
                                     "fullstring")
     type(r).text = PropertyMock(return_value="success")
     type(r).status_code = PropertyMock(return_value=200)
     assert r.text == "success"
     assert r.status_code == 200
     delete_request.assert_called_with('deleteapi',
                                       'Endpoint', {'a': 'Text'},
                                       cookies=None,
                                       timeout=None)
     create_session.assert_called_with('deleteapi',
                                       'fullstring',
                                       None,
                                       timeout=None)
示例#6
0
 def test_delete_insecure_request(self, disable_warnings, delete_request,
                                  create_session):
     library = APILibrary()
     library.suppress_insecure_request_warnings()
     library.call_delete_request({"a": "Text"}, "Endpoint", "fullstring")
     disable_warnings.assert_called()