def test_patch_called_with(self, patch_request, create_session): library = APILibrary() library.call_patch_request({"a": "Text"}, "Endpoint", "fullstring") patch_request.assert_called_with("patchapi", "fullstring", None, timeout=None) create_session.assert_called_with("patchapi", "Endpoint", {"a": "Text"}, cookies=None, timeout=None)
def test_patch_with_cookies(self, patch_on_session, create_session): library = APILibrary() library.call_patch_request({"a": "Text"}, "Endpoint", "fullstring", None, "chocolate_chip") patch_on_session.assert_called_with("patchapi", "fullstring", None, timeout=None, expected_status='any') create_session.assert_called_with("patchapi", "Endpoint", {"a": "Text"}, cookies="chocolate_chip", timeout=None)
def test_patch_insecure_request(self, disable_warnings, patch_request, create_session): library = APILibrary() library.suppress_insecure_request_warnings() library.call_patch_request({"a": "Text"}, "Endpoint", "fullstring") disable_warnings.assert_called() patch_request.assert_called_with("patchapi", "fullstring", None, timeout=None) create_session.assert_called_with("patchapi", "Endpoint", {"a": "Text"}, cookies=None, timeout=None)
def test_basic_patch(self, create_session, patch_request): library = APILibrary() r = library.call_patch_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
def test_basic_patch(self, create_session, patch_request): library = APILibrary() r = library.call_patch_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 patch_request.assert_called_with('patchapi', 'Endpoint', {'a': 'Text'}, cookies=None, timeout=None) create_session.assert_called_with('patchapi', 'fullstring', None, timeout=None)
def test_patch_insecure_request(self, disable_warnings, patch_request, create_session): library = APILibrary() library.suppress_insecure_request_warnings() library.call_patch_request({"a": "Text"}, "Endpoint", "fullstring") disable_warnings.assert_called()