def test_http_context_singleton_clear(self): ctxt_singleton = HttpRequestContextSingleton.get_instance() ctxt_singleton.method = "POST" self.assertEqual("POST", ctxt_singleton.method) ctxt_singleton.clear() self.assertNotEqual("POST", ctxt_singleton.method) ctxt_singleton2 = HttpRequestContextSingleton.get_instance() self.assertNotEqual("POST", ctxt_singleton2.method)
def test_http_context_clear(self): ctxt_singleton = HttpRequestContextSingleton.get_instance() ctxt_singleton.method = "POST" self.assertEqual("POST", ctxt_singleton.method) ctxt_singleton.clear() self.assertNotEqual("POST", ctxt_singleton.method) ctxt_singleton2 = HttpRequestContextSingleton.get_instance() self.assertNotEqual("POST", ctxt_singleton2.method)
def test_http_context_fields_to_clear(self): ctxt_singleton = HttpRequestContextSingleton.get_instance() ctxt_singleton.fields_to_clear = ['proxy'] ctxt_singleton.proxy = "http://localhost:8080" ctxt_singleton.method = "PUT" self.assertEqual("http://localhost:8080", ctxt_singleton.proxy) ctxt_singleton.clear() self.assertNotEqual("http://localhost:8080", ctxt_singleton.proxy) self.assertEqual("PUT", ctxt_singleton.method) ctxt_singleton2 = HttpRequestContextSingleton.get_instance() self.assertNotEqual("http://localhost:8080", ctxt_singleton2.proxy) self.assertEqual("PUT", ctxt_singleton2.method)
def test_http_context_singleton_fields_to_clear(self): ctxt_singleton = HttpRequestContextSingleton.get_instance() ctxt_singleton.fields_to_clear = ['proxy'] ctxt_singleton.proxy = "http://localhost:8080" ctxt_singleton.method = "PUT" self.assertEqual("http://localhost:8080", ctxt_singleton.proxy) ctxt_singleton.clear() self.assertNotEqual("http://localhost:8080", ctxt_singleton.proxy) self.assertEqual("PUT", ctxt_singleton.method) ctxt_singleton2 = HttpRequestContextSingleton.get_instance() self.assertNotEqual("http://localhost:8080", ctxt_singleton2.proxy) self.assertEqual("PUT", ctxt_singleton2.method)
def send_http_request_with_query_parameters(context, method): query_params = dict() for row in context.table: query_params[row["param_name"]] = row["param_value"] http_request_context = HttpRequestContextSingleton.get_instance() http_request_context.method = method http_request_context.query_params = query_params context.api_response = api.http_request_from_context(http_request_context) http_request_context.clear()
def test_http_context_sigleton(self): ctxt_singleton = HttpRequestContextSingleton.get_instance() ctxt_singleton.method = "POST" ctxt_singleton2 = HttpRequestContextSingleton.get_instance() self.assertEqual(ctxt_singleton.method, ctxt_singleton2.method)
def set_default_host(context, host): http_request_context = HttpRequestContextSingleton.get_instance() http_request_context.host = host
def send_http_request(context, method): http_request_context = HttpRequestContextSingleton.get_instance() http_request_context.method = method context.api_response = api.http_request_from_context(http_request_context) http_request_context.clear()
def set_body_files(context): files = dict() for row in context.table: files[row["param_name"]] = row["path_to_file"] http_request_context = HttpRequestContextSingleton.get_instance() http_request_context.files = files
def set_body_parameters(context): body_params = dict() for row in context.table: body_params[row["param_name"]] = row["param_value"] http_request_context = HttpRequestContextSingleton.get_instance() http_request_context.body_params = body_params
def set_headers(context): headers = dict() for row in context.table: headers[row["header_name"]] = row["header_value"] http_request_context = HttpRequestContextSingleton.get_instance() http_request_context.headers = headers
def set_11path_authorization(context, app_id, secret): http_request_context = HttpRequestContextSingleton.get_instance() http_request_context.authentication_instances.append(X11PathsAuthentication(app_id=app_id, secret=secret))
def set_authorization_basic(context, username, password): http_request_context = HttpRequestContextSingleton.get_instance() http_request_context.authentication_instances.append(BasicAuthentication(username=username, password=password))
def set_url_path_with_params(context, url_path_str_format): table_as_json = dict(context.table) url_path = url_path_str_format % table_as_json http_request_context = HttpRequestContextSingleton.get_instance() http_request_context.url_path = url_path
def set_url_path(context, url_path): http_request_context = HttpRequestContextSingleton.get_instance() http_request_context.url_path = url_path