コード例 #1
0
 def test_get_called_with(self, get_request, create_session):
     library = APILibrary()
     library.call_get_request({"a": "Text"}, "Endpoint", "fullstring")
     get_request.assert_called_with("getapi", "fullstring", timeout=None)
     create_session.assert_called_with("getapi",
                                       "Endpoint", {"a": "Text"},
                                       cookies=None,
                                       timeout=None)
コード例 #2
0
 def test_get_with_cookies(self, get_request, create_session):
     library = APILibrary()
     library.call_get_request({"a": "Text"}, "Endpoint", "fullstring",
                              "chocolate_chip")
     assert get_request.called_with("getapi", "fullstring")
     assert create_session.called_with("getapi",
                                       "Endpoint", {"a": "Text"},
                                       cookies="chocolate_chip")
コード例 #3
0
 def test_get_insecure_request(self, disable_warnings, get_request,
                               create_session):
     library = APILibrary()
     library.suppress_insecure_request_warnings()
     library.call_get_request({"a": "Text"}, "Endpoint", "fullstring")
     disable_warnings.assert_called()
     get_request.assert_called_with("getapi", "fullstring", timeout=None)
     create_session.assert_called_with("getapi",
                                       "Endpoint", {"a": "Text"},
                                       cookies=None,
                                       timeout=None)
コード例 #4
0
ファイル: test_calls.py プロジェクト: Wolfe1/zoomba
 def test_get_with_cookies(self, get_on_session, create_session):
     library = APILibrary()
     library.call_get_request({"a": "Text"}, "Endpoint", "fullstring",
                              "chocolate_chip")
     get_on_session.assert_called_with("getapi",
                                       "fullstring",
                                       timeout=None,
                                       expected_status='any')
     create_session.assert_called_with("getapi",
                                       "Endpoint", {"a": "Text"},
                                       cookies="chocolate_chip",
                                       timeout=None)
コード例 #5
0
 def test_basic_get(self, create_session, get_request):
     library = APILibrary()
     r = library.call_get_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
コード例 #6
0
 def test_basic_get(self, create_session, get_request):
     library = APILibrary()
     r = library.call_get_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
     create_session.assert_called_with("getapi", "fullstring", timeout=None)
     get_request.assert_called_with("getapi",
                                    "Endpoint", {"a": "Text"},
                                    cookies=None,
                                    timeout=None)
コード例 #7
0
 def test_get_insecure_request(self, disable_warnings, get_request,
                               create_session):
     library = APILibrary()
     library.suppress_insecure_request_warnings()
     library.call_get_request({"a": "Text"}, "Endpoint", "fullstring")
     disable_warnings.assert_called()