From b4a04ae437b9247553f12d34e5b99fa60daee1c3 Mon Sep 17 00:00:00 2001 From: Sanjin Date: Wed, 1 Mar 2023 15:23:03 +0100 Subject: [PATCH 01/47] Add: Storing input in JSON issue/2 --- httpie/cli/argtemplate.py | 38 ++++++++++++++++++++++++++++++++++++++ httpie/cli/templates.json | 1 + 2 files changed, 39 insertions(+) create mode 100644 httpie/cli/argtemplate.py create mode 100644 httpie/cli/templates.json diff --git a/httpie/cli/argtemplate.py b/httpie/cli/argtemplate.py new file mode 100644 index 0000000000..2e2714c692 --- /dev/null +++ b/httpie/cli/argtemplate.py @@ -0,0 +1,38 @@ +import argparse +import json +import sys + +def store_json_template(args): + """ + Store a template as a string in templates.json, the format for running this is: + http template || login=testuser password=testpassword ... + """ + template_name = args.pop(0) + template_method = None + template_url = None + template_variables = {} + + if ["CONNECT", "DELETE", "GET", "HEAD", "OPTIONS", "POST", "PUT", "TRACE", "PATCH"].__contains__(args[0]): + template_method = args.pop(0) + template_url = args.pop(0) + else: + template_url = args.pop(0) + + for arg in args: + variable_name, variable_value = arg.split("=") + template_variables[variable_name] = variable_value + + template = {} + template['method'] = template_method + template['url'] = template_url + template['data'] = template_variables + with open("httpie/cli/templates.json", "r+") as f: + stored_templates = {} + try: + stored_templates = json.load(f) + except json.JSONDecodeError: + pass + stored_templates[template_name] = template + f.seek(0) + json.dump(stored_templates, f) + diff --git a/httpie/cli/templates.json b/httpie/cli/templates.json new file mode 100644 index 0000000000..126af2428e --- /dev/null +++ b/httpie/cli/templates.json @@ -0,0 +1 @@ +{"nytemplate": {"method": "POST", "url": "google.se", "data": {"name": "adam"}}, "nytemplate2": {"method": "POST", "url": "google.com", "data": {"name": "adam"}}} \ No newline at end of file From 0ce2676d2bc0e25921a06595e3c786ef9708c76a Mon Sep 17 00:00:00 2001 From: Sanjin Date: Wed, 1 Mar 2023 15:24:07 +0100 Subject: [PATCH 02/47] Add: Calling store_json_template from httpie CLI parser issue/3 --- httpie/core.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/httpie/core.py b/httpie/core.py index d0c26dcbcc..0393de6589 100644 --- a/httpie/core.py +++ b/httpie/core.py @@ -48,6 +48,12 @@ def raw_main( if use_default_options and env.config.default_options: args = env.config.default_options + args + if (args[0] == "template"): + print("Testet fungerar -------") + from httpie.cli.argtemplate import store_json_template + store_json_template(args[1:]) + return ExitStatus.SUCCESS + include_debug_info = '--debug' in args include_traceback = include_debug_info or '--traceback' in args From a154b759b1d7975e314870ddeca4d31e1ec1aebe Mon Sep 17 00:00:00 2001 From: Sanjin Date: Wed, 1 Mar 2023 15:59:57 +0100 Subject: [PATCH 03/47] Add: Running template functionality issue/4 --- httpie/core.py | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/httpie/core.py b/httpie/core.py index 0393de6589..5ac32bddd2 100644 --- a/httpie/core.py +++ b/httpie/core.py @@ -1,4 +1,5 @@ import argparse +import json import os import platform import sys @@ -48,11 +49,32 @@ def raw_main( if use_default_options and env.config.default_options: args = env.config.default_options + args + def load_template(arg): + with open("httpie/cli/templates.json", "r+") as f: + stored_templates = {} + try: + stored_templates = json.load(f) + except json.JSONDecodeError: + pass + args = [] + args_dict = stored_templates[arg] + if not args_dict is None: + args.append(args_dict.pop('method')) + args.append(args_dict.pop('url')) + data_dict = args_dict.pop('data') + for _, value in data_dict.items(): + args.append(value) + return args + if (args[0] == "template"): - print("Testet fungerar -------") from httpie.cli.argtemplate import store_json_template store_json_template(args[1:]) return ExitStatus.SUCCESS + + if (args[0] == "runt"): + from httpie.cli.argtemplate import store_json_template + args = load_template(args[1]) + include_debug_info = '--debug' in args include_traceback = include_debug_info or '--traceback' in args From d7887626a178158100d394ba4e5b6e9a351c1d8e Mon Sep 17 00:00:00 2001 From: Sanjin Date: Wed, 1 Mar 2023 16:44:29 +0100 Subject: [PATCH 04/47] Add: Functionality to modify template issue/5 --- httpie/cli/argtemplate.py | 26 ++++++++++++++++++++++++++ httpie/core.py | 10 +++++++++- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/httpie/cli/argtemplate.py b/httpie/cli/argtemplate.py index 2e2714c692..cd83545f7b 100644 --- a/httpie/cli/argtemplate.py +++ b/httpie/cli/argtemplate.py @@ -32,7 +32,33 @@ def store_json_template(args): stored_templates = json.load(f) except json.JSONDecodeError: pass + if template_name in stored_templates: + stored_templates.pop(template_name) stored_templates[template_name] = template f.seek(0) json.dump(stored_templates, f) + f.truncate() + +def edit_json_template(args): + stored_templates = {} + with open("httpie/cli/templates.json", "r+") as f: + try: + stored_templates = json.load(f) + except json.JSONDecodeError: + pass + template_name = args.pop(0) + template_item = args.pop(0) + template_value = args.pop(0) + updated_template = {} + if template_name in stored_templates: + updated_template = stored_templates.pop(template_name) + + updated_template[template_item] = template_value + stored_templates[template_name] = updated_template + f.seek(0) + json.dump(stored_templates, f) + f.truncate() + + + diff --git a/httpie/core.py b/httpie/core.py index 5ac32bddd2..4f70b442c9 100644 --- a/httpie/core.py +++ b/httpie/core.py @@ -65,15 +65,23 @@ def load_template(arg): for _, value in data_dict.items(): args.append(value) return args - + + # http template || || if (args[0] == "template"): from httpie.cli.argtemplate import store_json_template store_json_template(args[1:]) return ExitStatus.SUCCESS + # http runt if (args[0] == "runt"): from httpie.cli.argtemplate import store_json_template args = load_template(args[1]) + + # http editt + if (args[0] == "editt"): + from httpie.cli.argtemplate import edit_json_template + edit_json_template(args[1:]) + return ExitStatus.SUCCESS include_debug_info = '--debug' in args From 16c98cc9023a1afbf7d2bcb5eddcbc890440c5f4 Mon Sep 17 00:00:00 2001 From: editf Date: Wed, 1 Mar 2023 22:38:48 +0100 Subject: [PATCH 05/47] Refactor: move load_template to argtemplate This moves the load_template function to the argtemplate file as well as makes the file path where the templates are stored into a global variable. --- httpie/cli/argtemplate.py | 25 ++++++++++++++++++++----- httpie/core.py | 24 +++--------------------- 2 files changed, 23 insertions(+), 26 deletions(-) diff --git a/httpie/cli/argtemplate.py b/httpie/cli/argtemplate.py index cd83545f7b..49ee81b41a 100644 --- a/httpie/cli/argtemplate.py +++ b/httpie/cli/argtemplate.py @@ -2,6 +2,8 @@ import json import sys +TEMPLATE_FILE = "httpie/cli/templates.json" + def store_json_template(args): """ Store a template as a string in templates.json, the format for running this is: @@ -26,7 +28,7 @@ def store_json_template(args): template['method'] = template_method template['url'] = template_url template['data'] = template_variables - with open("httpie/cli/templates.json", "r+") as f: + with open(TEMPLATE_FILE, "r+") as f: stored_templates = {} try: stored_templates = json.load(f) @@ -41,7 +43,7 @@ def store_json_template(args): def edit_json_template(args): stored_templates = {} - with open("httpie/cli/templates.json", "r+") as f: + with open(TEMPLATE_FILE, "r+") as f: try: stored_templates = json.load(f) except json.JSONDecodeError: @@ -59,6 +61,19 @@ def edit_json_template(args): json.dump(stored_templates, f) f.truncate() - - - +def load_template(arg): + with open(TEMPLATE_FILE, "r+") as f: + stored_templates = {} + try: + stored_templates = json.load(f) + except json.JSONDecodeError: + pass + args = [] + args_dict = stored_templates[arg] + if not args_dict is None: + args.append(args_dict.pop('method')) + args.append(args_dict.pop('url')) + data_dict = args_dict.pop('data') + for _, value in data_dict.items(): + args.append(value) + return args diff --git a/httpie/core.py b/httpie/core.py index 4f70b442c9..a72a5c779a 100644 --- a/httpie/core.py +++ b/httpie/core.py @@ -49,32 +49,15 @@ def raw_main( if use_default_options and env.config.default_options: args = env.config.default_options + args - def load_template(arg): - with open("httpie/cli/templates.json", "r+") as f: - stored_templates = {} - try: - stored_templates = json.load(f) - except json.JSONDecodeError: - pass - args = [] - args_dict = stored_templates[arg] - if not args_dict is None: - args.append(args_dict.pop('method')) - args.append(args_dict.pop('url')) - data_dict = args_dict.pop('data') - for _, value in data_dict.items(): - args.append(value) - return args - - # http template || || + # http template || || if (args[0] == "template"): from httpie.cli.argtemplate import store_json_template store_json_template(args[1:]) return ExitStatus.SUCCESS - + # http runt if (args[0] == "runt"): - from httpie.cli.argtemplate import store_json_template + from httpie.cli.argtemplate import store_json_template, load_template args = load_template(args[1]) # http editt @@ -82,7 +65,6 @@ def load_template(arg): from httpie.cli.argtemplate import edit_json_template edit_json_template(args[1:]) return ExitStatus.SUCCESS - include_debug_info = '--debug' in args include_traceback = include_debug_info or '--traceback' in args From 373f6bd314bf4f12f400d534466f80a540fd12e5 Mon Sep 17 00:00:00 2001 From: editf Date: Wed, 1 Mar 2023 22:42:55 +0100 Subject: [PATCH 06/47] Add test log from running tests on original repo Some tests fail when run on Mac but not on Windows. There appears to be minor differences in the error output. --- test_log_before.txt | 1506 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1506 insertions(+) create mode 100644 test_log_before.txt diff --git a/test_log_before.txt b/test_log_before.txt new file mode 100644 index 0000000000..216f9ce499 --- /dev/null +++ b/test_log_before.txt @@ -0,0 +1,1506 @@ + + +### Cleaning up ###  + +rm -rf venv +# Remove symlink for virtualenvwrapper, if we’ve created one. +[ -n "" -a -L "/httpie" -a -f "/httpie" ] && rm /httpie || true +rm -rf *.egg dist build .coverage .cache .pytest_cache httpie.egg-info +find . -name '__pycache__' -delete -o -name '*.pyc' -delete + + + +### Creating a Python environment venv ###  + +python3 -m venv --prompt httpie venv + +done. + +To active it manually, run: + + source venv/bin/activate + +(learn more: https://docs.python.org/3/library/venv.html) + + + +### Updating package tools ###  + +venv/bin/pip3 install --upgrade pip wheel build +Requirement already satisfied: pip in ./venv/lib/python3.11/site-packages (22.3.1) +Collecting pip + Using cached pip-23.0.1-py3-none-any.whl (2.1 MB) +Collecting wheel + Using cached wheel-0.38.4-py3-none-any.whl (36 kB) +Collecting build + Using cached build-0.10.0-py3-none-any.whl (17 kB) +Collecting packaging>=19.0 + Using cached packaging-23.0-py3-none-any.whl (42 kB) +Collecting pyproject_hooks + Using cached pyproject_hooks-1.0.0-py3-none-any.whl (9.3 kB) +Installing collected packages: wheel, pyproject_hooks, pip, packaging, build + Attempting uninstall: pip + Found existing installation: pip 22.3.1 + Uninstalling pip-22.3.1: + Successfully uninstalled pip-22.3.1 +Successfully installed build-0.10.0 packaging-23.0 pip-23.0.1 pyproject_hooks-1.0.0 wheel-0.38.4 + + +### Installing dev requirements ###  + +venv/bin/pip3 install --upgrade '.[dev]' '.[test]' +Processing /Users/editflores/editf-github/dd2480/DD2480-httpie + Preparing metadata (setup.py): started + Preparing metadata (setup.py): finished with status 'done' +Requirement already satisfied: pip in ./venv/lib/python3.11/site-packages (from httpie==3.2.1) (23.0.1) +Collecting charset_normalizer>=2.0.0 + Using cached charset_normalizer-3.0.1-cp311-cp311-macosx_10_9_x86_64.whl (122 kB) +Collecting defusedxml>=0.6.0 + Using cached defusedxml-0.7.1-py2.py3-none-any.whl (25 kB) +Collecting requests[socks]>=2.22.0 + Using cached requests-2.28.2-py3-none-any.whl (62 kB) +Collecting Pygments>=2.5.2 + Using cached Pygments-2.14.0-py3-none-any.whl (1.1 MB) +Collecting requests-toolbelt>=0.9.1 + Using cached requests_toolbelt-0.10.1-py2.py3-none-any.whl (54 kB) +Collecting multidict>=4.7.0 + Using cached multidict-6.0.4-cp311-cp311-macosx_10_9_x86_64.whl (29 kB) +Requirement already satisfied: setuptools in ./venv/lib/python3.11/site-packages (from httpie==3.2.1) (65.5.0) +Collecting rich>=9.10.0 + Using cached rich-13.3.1-py3-none-any.whl (239 kB) +Collecting pytest + Using cached pytest-7.2.1-py3-none-any.whl (317 kB) +Collecting pytest-httpbin>=0.0.6 + Using cached pytest_httpbin-1.0.2-py2.py3-none-any.whl (9.8 kB) +Collecting pytest-lazy-fixture>=0.0.6 + Using cached pytest_lazy_fixture-0.6.3-py3-none-any.whl (4.9 kB) +Collecting responses + Using cached responses-0.22.0-py3-none-any.whl (51 kB) +Collecting pytest-mock + Using cached pytest_mock-3.10.0-py3-none-any.whl (9.3 kB) +Collecting werkzeug<2.1.0 + Using cached Werkzeug-2.0.3-py3-none-any.whl (289 kB) +Collecting flake8 + Using cached flake8-6.0.0-py2.py3-none-any.whl (57 kB) +Collecting flake8-comprehensions + Using cached flake8_comprehensions-3.10.1-py3-none-any.whl (7.3 kB) +Collecting flake8-deprecated + Using cached flake8_deprecated-2.0.1-py3-none-any.whl (11 kB) +Collecting flake8-mutable + Using cached flake8_mutable-1.2.0-py3-none-any.whl +Collecting flake8-tuple + Using cached flake8_tuple-0.4.1-py2.py3-none-any.whl (5.1 kB) +Collecting pyopenssl + Using cached pyOpenSSL-23.0.0-py3-none-any.whl (57 kB) +Collecting pytest-cov + Using cached pytest_cov-4.0.0-py3-none-any.whl (21 kB) +Collecting pyyaml + Using cached PyYAML-6.0-cp311-cp311-macosx_10_9_x86_64.whl (188 kB) +Collecting twine + Using cached twine-4.0.2-py3-none-any.whl (36 kB) +Requirement already satisfied: wheel in ./venv/lib/python3.11/site-packages (from httpie==3.2.1) (0.38.4) +Collecting Jinja2 + Using cached Jinja2-3.1.2-py3-none-any.whl (133 kB) +Collecting httpbin + Using cached httpbin-0.7.0-py2.py3-none-any.whl (86 kB) +Collecting six + Using cached six-1.16.0-py2.py3-none-any.whl (11 kB) +Collecting attrs>=19.2.0 + Using cached attrs-22.2.0-py3-none-any.whl (60 kB) +Collecting iniconfig + Using cached iniconfig-2.0.0-py3-none-any.whl (5.9 kB) +Requirement already satisfied: packaging in ./venv/lib/python3.11/site-packages (from pytest->httpie==3.2.1) (23.0) +Collecting pluggy<2.0,>=0.12 + Using cached pluggy-1.0.0-py2.py3-none-any.whl (13 kB) +Collecting idna<4,>=2.5 + Using cached idna-3.4-py3-none-any.whl (61 kB) +Collecting urllib3<1.27,>=1.21.1 + Using cached urllib3-1.26.14-py2.py3-none-any.whl (140 kB) +Collecting certifi>=2017.4.17 + Using cached certifi-2022.12.7-py3-none-any.whl (155 kB) +Collecting PySocks!=1.5.7,>=1.5.6 + Using cached PySocks-1.7.1-py3-none-any.whl (16 kB) +Collecting markdown-it-py<3.0.0,>=2.1.0 + Using cached markdown_it_py-2.2.0-py3-none-any.whl (84 kB) +Collecting mccabe<0.8.0,>=0.7.0 + Using cached mccabe-0.7.0-py2.py3-none-any.whl (7.3 kB) +Collecting pycodestyle<2.11.0,>=2.10.0 + Using cached pycodestyle-2.10.0-py2.py3-none-any.whl (41 kB) +Collecting pyflakes<3.1.0,>=3.0.0 + Using cached pyflakes-3.0.1-py2.py3-none-any.whl (62 kB) +Collecting MarkupSafe>=2.0 + Using cached MarkupSafe-2.1.2-cp311-cp311-macosx_10_9_x86_64.whl (13 kB) +Collecting cryptography<40,>=38.0.0 + Using cached cryptography-39.0.1-cp36-abi3-macosx_10_12_x86_64.whl (2.9 MB) +Collecting coverage[toml]>=5.2.1 + Using cached coverage-7.2.1-cp311-cp311-macosx_10_9_x86_64.whl (199 kB) +Collecting toml + Using cached toml-0.10.2-py2.py3-none-any.whl (16 kB) +Collecting types-toml + Using cached types_toml-0.10.8.5-py3-none-any.whl (4.5 kB) +Collecting pkginfo>=1.8.1 + Using cached pkginfo-1.9.6-py3-none-any.whl (30 kB) +Collecting readme-renderer>=35.0 + Using cached readme_renderer-37.3-py3-none-any.whl (14 kB) +Collecting importlib-metadata>=3.6 + Using cached importlib_metadata-6.0.0-py3-none-any.whl (21 kB) +Collecting keyring>=15.1 + Using cached keyring-23.13.1-py3-none-any.whl (37 kB) +Collecting rfc3986>=1.4.0 + Using cached rfc3986-2.0.0-py2.py3-none-any.whl (31 kB) +Collecting cffi>=1.12 + Using cached cffi-1.15.1-cp311-cp311-macosx_10_9_x86_64.whl (179 kB) +Collecting zipp>=0.5 + Using cached zipp-3.15.0-py3-none-any.whl (6.8 kB) +Collecting jaraco.classes + Using cached jaraco.classes-3.2.3-py3-none-any.whl (6.0 kB) +Collecting mdurl~=0.1 + Using cached mdurl-0.1.2-py3-none-any.whl (10.0 kB) +Collecting bleach>=2.1.0 + Using cached bleach-6.0.0-py3-none-any.whl (162 kB) +Collecting docutils>=0.13.1 + Using cached docutils-0.19-py3-none-any.whl (570 kB) +Collecting Flask + Using cached Flask-2.2.3-py3-none-any.whl (101 kB) +Collecting decorator + Using cached decorator-5.1.1-py3-none-any.whl (9.1 kB) +Collecting itsdangerous + Using cached itsdangerous-2.1.2-py3-none-any.whl (15 kB) +Collecting brotlipy + Using cached brotlipy-0.7.0-cp35-abi3-macosx_10_9_x86_64.whl (390 kB) +Collecting raven[flask] + Using cached raven-6.10.0-py2.py3-none-any.whl (284 kB) +Collecting webencodings + Using cached webencodings-0.5.1-py2.py3-none-any.whl (11 kB) +Collecting pycparser + Using cached pycparser-2.21-py2.py3-none-any.whl (118 kB) +Collecting Flask + Using cached Flask-2.2.2-py3-none-any.whl (101 kB) + Using cached Flask-2.2.1-py3-none-any.whl (101 kB) + Using cached Flask-2.2.0-py3-none-any.whl (101 kB) + Using cached Flask-2.1.3-py3-none-any.whl (95 kB) +Collecting click>=8.0 + Using cached click-8.1.3-py3-none-any.whl (96 kB) +Collecting more-itertools + Using cached more_itertools-9.1.0-py3-none-any.whl (54 kB) +Collecting blinker>=1.1 + Using cached blinker-1.5-py2.py3-none-any.whl (12 kB) +Building wheels for collected packages: httpie + Building wheel for httpie (setup.py): started + Building wheel for httpie (setup.py): finished with status 'done' + Created wheel for httpie: filename=httpie-3.2.1-py3-none-any.whl size=127273 sha256=10a5d59edb18c5500fbdb366e1b5b45e4dc7fde6f7b614314cef8ca17a441532 + Stored in directory: /Users/editflores/Library/Caches/pip/wheels/2e/b4/cb/4ae72cc07f9532f0350e27ff635198c5d65835e8095ef3e3b2 +Successfully built httpie +Installing collected packages: webencodings, types-toml, raven, charset_normalizer, zipp, werkzeug, urllib3, toml, six, rfc3986, pyyaml, PySocks, Pygments, pyflakes, pycparser, pycodestyle, pluggy, pkginfo, multidict, more-itertools, mdurl, mccabe, MarkupSafe, itsdangerous, iniconfig, idna, docutils, defusedxml, decorator, coverage, click, certifi, blinker, attrs, requests, pytest, markdown-it-py, Jinja2, jaraco.classes, importlib-metadata, flake8, cffi, bleach, rich, responses, requests-toolbelt, readme-renderer, pytest-mock, pytest-lazy-fixture, pytest-cov, keyring, Flask, flake8-tuple, flake8-mutable, flake8-deprecated, flake8-comprehensions, cryptography, brotlipy, twine, pyopenssl, httpie, httpbin, pytest-httpbin +Successfully installed Flask-2.1.3 Jinja2-3.1.2 MarkupSafe-2.1.2 PySocks-1.7.1 Pygments-2.14.0 attrs-22.2.0 bleach-6.0.0 blinker-1.5 brotlipy-0.7.0 certifi-2022.12.7 cffi-1.15.1 charset_normalizer-3.0.1 click-8.1.3 coverage-7.2.1 cryptography-39.0.1 decorator-5.1.1 defusedxml-0.7.1 docutils-0.19 flake8-6.0.0 flake8-comprehensions-3.10.1 flake8-deprecated-2.0.1 flake8-mutable-1.2.0 flake8-tuple-0.4.1 httpbin-0.7.0 httpie-3.2.1 idna-3.4 importlib-metadata-6.0.0 iniconfig-2.0.0 itsdangerous-2.1.2 jaraco.classes-3.2.3 keyring-23.13.1 markdown-it-py-2.2.0 mccabe-0.7.0 mdurl-0.1.2 more-itertools-9.1.0 multidict-6.0.4 pkginfo-1.9.6 pluggy-1.0.0 pycodestyle-2.10.0 pycparser-2.21 pyflakes-3.0.1 pyopenssl-23.0.0 pytest-7.2.1 pytest-cov-4.0.0 pytest-httpbin-1.0.2 pytest-lazy-fixture-0.6.3 pytest-mock-3.10.0 pyyaml-6.0 raven-6.10.0 readme-renderer-37.3 requests-2.28.2 requests-toolbelt-0.10.1 responses-0.22.0 rfc3986-2.0.0 rich-13.3.1 six-1.16.0 toml-0.10.2 twine-4.0.2 types-toml-0.10.8.5 urllib3-1.26.14 webencodings-0.5.1 werkzeug-2.0.3 zipp-3.15.0 + + +### Installing HTTPie ###  + +venv/bin/pip3 install --upgrade --editable . +Obtaining file:///Users/editflores/editf-github/dd2480/DD2480-httpie + Preparing metadata (setup.py): started + Preparing metadata (setup.py): finished with status 'done' +Requirement already satisfied: pip in ./venv/lib/python3.11/site-packages (from httpie==3.2.1) (23.0.1) +Requirement already satisfied: charset_normalizer>=2.0.0 in ./venv/lib/python3.11/site-packages (from httpie==3.2.1) (3.0.1) +Requirement already satisfied: defusedxml>=0.6.0 in ./venv/lib/python3.11/site-packages (from httpie==3.2.1) (0.7.1) +Requirement already satisfied: requests[socks]>=2.22.0 in ./venv/lib/python3.11/site-packages (from httpie==3.2.1) (2.28.2) +Requirement already satisfied: Pygments>=2.5.2 in ./venv/lib/python3.11/site-packages (from httpie==3.2.1) (2.14.0) +Requirement already satisfied: requests-toolbelt>=0.9.1 in ./venv/lib/python3.11/site-packages (from httpie==3.2.1) (0.10.1) +Requirement already satisfied: multidict>=4.7.0 in ./venv/lib/python3.11/site-packages (from httpie==3.2.1) (6.0.4) +Requirement already satisfied: setuptools in ./venv/lib/python3.11/site-packages (from httpie==3.2.1) (65.5.0) +Requirement already satisfied: rich>=9.10.0 in ./venv/lib/python3.11/site-packages (from httpie==3.2.1) (13.3.1) +Requirement already satisfied: idna<4,>=2.5 in ./venv/lib/python3.11/site-packages (from requests[socks]>=2.22.0->httpie==3.2.1) (3.4) +Requirement already satisfied: urllib3<1.27,>=1.21.1 in ./venv/lib/python3.11/site-packages (from requests[socks]>=2.22.0->httpie==3.2.1) (1.26.14) +Requirement already satisfied: certifi>=2017.4.17 in ./venv/lib/python3.11/site-packages (from requests[socks]>=2.22.0->httpie==3.2.1) (2022.12.7) +Requirement already satisfied: PySocks!=1.5.7,>=1.5.6 in ./venv/lib/python3.11/site-packages (from requests[socks]>=2.22.0->httpie==3.2.1) (1.7.1) +Requirement already satisfied: markdown-it-py<3.0.0,>=2.1.0 in ./venv/lib/python3.11/site-packages (from rich>=9.10.0->httpie==3.2.1) (2.2.0) +Requirement already satisfied: mdurl~=0.1 in ./venv/lib/python3.11/site-packages (from markdown-it-py<3.0.0,>=2.1.0->rich>=9.10.0->httpie==3.2.1) (0.1.2) +Installing collected packages: httpie + Attempting uninstall: httpie + Found existing installation: httpie 3.2.1 + Uninstalling httpie-3.2.1: + Successfully uninstalled httpie-3.2.1 + Running setup.py develop for httpie +Successfully installed httpie-3.2.1 + + + +### Running tests ###  + +venv/bin/python -m pytest +============================= test session starts ============================== +platform darwin -- Python 3.11.1, pytest-7.2.1, pluggy-1.0.0 +rootdir: /Users/editflores/editf-github/dd2480/DD2480-httpie, configfile: pytest.ini +plugins: mock-3.10.0, cov-4.0.0, httpbin-1.0.2, lazy-fixture-0.6.3 +collected 1026 items + +tests/test_auth.py .......... [ 0%] +tests/test_compress.py ....... [ 1%] +tests/test_downloads.py ...... [ 2%] +tests/test_errors.py .... [ 2%] +tests/test_httpie.py ...........s............... [ 5%] +tests/test_json.py . [ 5%] +tests/test_auth.py .......... [ 6%] +tests/test_compress.py ....... [ 7%] +tests/test_downloads.py ...... [ 7%] +tests/test_errors.py .... [ 7%] +tests/test_httpie.py ...........s............... [ 10%] +tests/test_json.py . [ 10%] +tests/test_auth.py ......... [ 11%] +tests/test_auth_plugins.py .... [ 11%] +tests/test_binary.py ...... [ 12%] +tests/test_cli.py ..............F....................... [ 16%] +tests/test_cli_ui.py .... [ 16%] +tests/test_cli_utils.py .. [ 16%] +tests/test_compress.py .. [ 17%] +tests/test_config.py ........s [ 17%] +tests/test_cookie.py . [ 18%] +tests/test_cookie_on_redirects.py ..................... [ 20%] +tests/test_defaults.py ................. [ 21%] +tests/test_downloads.py .................... [ 23%] +tests/test_encoding.py ................................................. [ 28%] +.... [ 28%] +tests/test_errors.py .... [ 29%] +tests/test_exit_status.py ......... [ 30%] +tests/test_httpie.py ...................... [ 32%] +tests/test_httpie_cli.py ..................................... [ 35%] +tests/test_json.py ..................................................... [ 41%] +........................................................................ [ 48%] +........................................................................ [ 55%] +........................................................................ [ 62%] +....................... [ 64%] +tests/test_meta.py ...... [ 64%] +tests/test_offline.py ......... [ 65%] +tests/test_output.py ......FF.FxXx...................................... [ 70%] +........................................................................ [ 77%] +. [ 77%] +tests/test_parser_schema.py . [ 77%] +tests/test_plugins_cli.py ............... [ 79%] +tests/test_redirects.py ...x...... [ 80%] +tests/test_regressions.py ... [ 80%] +tests/test_sessions.py .........................FF.F.................... [ 85%] +............ [ 86%] +tests/test_ssl.py .ss.................... [ 88%] +tests/test_stream.py ................ [ 90%] +tests/test_tokens.py ................... [ 92%] +tests/test_transport_plugin.py . [ 92%] +tests/test_update_warnings.py ............ [ 93%] +tests/test_uploads.py ........................... [ 96%] +tests/test_windows.py s. [ 96%] +tests/test_xml.py ................. [ 98%] +tests/utils/matching/test_matching.py .................... [100%] + +=================================== FAILURES =================================== +_______________________ test_url_colon_slash_slash_only ________________________ + + def test_url_colon_slash_slash_only(): + r = http('://', tolerate_error_exit_status=True) +> assert r.stderr.strip() == "http: error: InvalidURL: Invalid URL 'http://': No host supplied" +E AssertionError: assert 'http: LogLev...host supplied' == 'http: error:...host supplied' +E - http: error: InvalidURL: Invalid URL 'http://': No host supplied +E ? ^^^^ +E + http: LogLevel.ERROR: InvalidURL: Invalid URL 'http://': No host supplied +E ? ++++ ^^^^^^^^^ + +tests/test_cli.py:192: AssertionError +----------------------------- Captured stderr call ----------------------------- + +http: LogLevel.ERROR: InvalidURL: Invalid URL 'http://': No host supplied + + +_____________ TestQuietFlag.test_quiet_with_check_status_non_zero ______________ + +self = +httpbin = + + def test_quiet_with_check_status_non_zero(self, httpbin): + r = http( + '--quiet', '--check-status', httpbin + '/status/500', + tolerate_error_exit_status=True, + ) +> assert 'http: warning: HTTP 500' in r.stderr +E AssertionError: assert 'http: warning: HTTP 500' in '\nhttp: LogLevel.WARNING: HTTP 500 INTERNAL SERVER ERROR\n\n\n' +E + where '\nhttp: LogLevel.WARNING: HTTP 500 INTERNAL SERVER ERROR\n\n\n' = ''.stderr + +tests/test_output.py:69: AssertionError +----------------------------- Captured stderr call ----------------------------- +127.0.0.1 - - [01/Mar/2023 13:07:04] "GET /status/500 HTTP/1.1" 500 0 + +http: LogLevel.WARNING: HTTP 500 INTERNAL SERVER ERROR + + +___________ TestQuietFlag.test_quiet_with_check_status_non_zero_pipe ___________ + +self = +httpbin = + + def test_quiet_with_check_status_non_zero_pipe(self, httpbin): + r = http( + '--quiet', '--check-status', httpbin + '/status/500', + tolerate_error_exit_status=True, + env=MockEnvironment(stdout_isatty=False) + ) +> assert 'http: warning: HTTP 500' in r.stderr +E AssertionError: assert 'http: warning: HTTP 500' in '\nhttp: LogLevel.WARNING: HTTP 500 INTERNAL SERVER ERROR\n\n\n' +E + where '\nhttp: LogLevel.WARNING: HTTP 500 INTERNAL SERVER ERROR\n\n\n' = ''.stderr + +tests/test_output.py:77: AssertionError +----------------------------- Captured stderr call ----------------------------- +127.0.0.1 - - [01/Mar/2023 13:07:04] "GET /status/500 HTTP/1.1" 500 0 + +http: LogLevel.WARNING: HTTP 500 INTERNAL SERVER ERROR + + +________ TestQuietFlag.test_quiet_quiet_with_check_status_non_zero_pipe ________ + +self = +httpbin = + + def test_quiet_quiet_with_check_status_non_zero_pipe(self, httpbin): + r = http( + '--quiet', '--quiet', '--check-status', httpbin + '/status/500', + tolerate_error_exit_status=True, + env=MockEnvironment(stdout_isatty=False) + ) +> assert 'http: warning: HTTP 500' in r.stderr +E AssertionError: assert 'http: warning: HTTP 500' in '\nhttp: LogLevel.WARNING: HTTP 500 INTERNAL SERVER ERROR\n\n\n' +E + where '\nhttp: LogLevel.WARNING: HTTP 500 INTERNAL SERVER ERROR\n\n\n' = ''.stderr + +tests/test_output.py:92: AssertionError +----------------------------- Captured stderr call ----------------------------- +127.0.0.1 - - [01/Mar/2023 13:07:04] "GET /status/500 HTTP/1.1" 500 0 + +http: LogLevel.WARNING: HTTP 500 INTERNAL SERVER ERROR + + +_ TestCookieStorage.test_existing_and_new_cookies_sent_in_request[new=bar;chocolate=milk-new_cookies_dict1-chocolate=milk; cookie1=foo; cookie2=foo; new=bar] _ + +self = +new_cookies = 'new=bar;chocolate=milk' +new_cookies_dict = {'chocolate': 'milk', 'new': 'bar'} +expected = 'chocolate=milk; cookie1=foo; cookie2=foo; new=bar' +httpbin = + + @pytest.mark.parametrize( + 'new_cookies, new_cookies_dict, expected', + [( + 'new=bar', + {'new': 'bar'}, + 'cookie1=foo; cookie2=foo; new=bar' + ), + ( + 'new=bar;chocolate=milk', + {'new': 'bar', 'chocolate': 'milk'}, + 'chocolate=milk; cookie1=foo; cookie2=foo; new=bar' + ), + ( + 'new=bar; chocolate=milk', + {'new': 'bar', 'chocolate': 'milk'}, + 'chocolate=milk; cookie1=foo; cookie2=foo; new=bar' + ), + ( + 'new=bar;; chocolate=milk;;;', + {'new': 'bar', 'chocolate': 'milk'}, + 'cookie1=foo; cookie2=foo; new=bar' + ), + ( + 'new=bar; chocolate=milk;;;', + {'new': 'bar', 'chocolate': 'milk'}, + 'chocolate=milk; cookie1=foo; cookie2=foo; new=bar' + ) + ] + ) + def test_existing_and_new_cookies_sent_in_request(self, new_cookies, new_cookies_dict, expected, httpbin): + r = http( + '--session', str(self.session_path), + '--print=H', + httpbin.url, + 'Cookie:' + new_cookies, + ) + # Note: cookies in response are in alphabetical order +> assert f'Cookie: {expected}' in r +E AssertionError: assert 'Cookie: chocolate=milk; cookie1=foo; cookie2=foo; new=bar' in 'GET / HTTP/1.1\r\nAccept: */*\r\nAccept-Encoding: gzip, deflate, br\r\nConnection: keep-alive\r\nCookie: cookie1=foo; cookie2=foo; new=bar; chocolate=milk\r\nHost: 127.0.0.1:59271\r\nUser-Agent: HTTPie/3.2.1\r\n\r\n' + +tests/test_sessions.py:485: AssertionError +----------------------------- Captured stderr call ----------------------------- +127.0.0.1 - - [01/Mar/2023 13:09:19] "GET / HTTP/1.1" 200 12144 +_ TestCookieStorage.test_existing_and_new_cookies_sent_in_request[new=bar; chocolate=milk-new_cookies_dict2-chocolate=milk; cookie1=foo; cookie2=foo; new=bar] _ + +self = +new_cookies = 'new=bar; chocolate=milk' +new_cookies_dict = {'chocolate': 'milk', 'new': 'bar'} +expected = 'chocolate=milk; cookie1=foo; cookie2=foo; new=bar' +httpbin = + + @pytest.mark.parametrize( + 'new_cookies, new_cookies_dict, expected', + [( + 'new=bar', + {'new': 'bar'}, + 'cookie1=foo; cookie2=foo; new=bar' + ), + ( + 'new=bar;chocolate=milk', + {'new': 'bar', 'chocolate': 'milk'}, + 'chocolate=milk; cookie1=foo; cookie2=foo; new=bar' + ), + ( + 'new=bar; chocolate=milk', + {'new': 'bar', 'chocolate': 'milk'}, + 'chocolate=milk; cookie1=foo; cookie2=foo; new=bar' + ), + ( + 'new=bar;; chocolate=milk;;;', + {'new': 'bar', 'chocolate': 'milk'}, + 'cookie1=foo; cookie2=foo; new=bar' + ), + ( + 'new=bar; chocolate=milk;;;', + {'new': 'bar', 'chocolate': 'milk'}, + 'chocolate=milk; cookie1=foo; cookie2=foo; new=bar' + ) + ] + ) + def test_existing_and_new_cookies_sent_in_request(self, new_cookies, new_cookies_dict, expected, httpbin): + r = http( + '--session', str(self.session_path), + '--print=H', + httpbin.url, + 'Cookie:' + new_cookies, + ) + # Note: cookies in response are in alphabetical order +> assert f'Cookie: {expected}' in r +E AssertionError: assert 'Cookie: chocolate=milk; cookie1=foo; cookie2=foo; new=bar' in 'GET / HTTP/1.1\r\nAccept: */*\r\nAccept-Encoding: gzip, deflate, br\r\nConnection: keep-alive\r\nCookie: cookie1=foo; cookie2=foo; new=bar; chocolate=milk\r\nHost: 127.0.0.1:59271\r\nUser-Agent: HTTPie/3.2.1\r\n\r\n' + +tests/test_sessions.py:485: AssertionError +----------------------------- Captured stderr call ----------------------------- +127.0.0.1 - - [01/Mar/2023 13:09:19] "GET / HTTP/1.1" 200 12144 +_ TestCookieStorage.test_existing_and_new_cookies_sent_in_request[new=bar; chocolate=milk;;;-new_cookies_dict4-chocolate=milk; cookie1=foo; cookie2=foo; new=bar] _ + +self = +new_cookies = 'new=bar; chocolate=milk;;;' +new_cookies_dict = {'chocolate': 'milk', 'new': 'bar'} +expected = 'chocolate=milk; cookie1=foo; cookie2=foo; new=bar' +httpbin = + + @pytest.mark.parametrize( + 'new_cookies, new_cookies_dict, expected', + [( + 'new=bar', + {'new': 'bar'}, + 'cookie1=foo; cookie2=foo; new=bar' + ), + ( + 'new=bar;chocolate=milk', + {'new': 'bar', 'chocolate': 'milk'}, + 'chocolate=milk; cookie1=foo; cookie2=foo; new=bar' + ), + ( + 'new=bar; chocolate=milk', + {'new': 'bar', 'chocolate': 'milk'}, + 'chocolate=milk; cookie1=foo; cookie2=foo; new=bar' + ), + ( + 'new=bar;; chocolate=milk;;;', + {'new': 'bar', 'chocolate': 'milk'}, + 'cookie1=foo; cookie2=foo; new=bar' + ), + ( + 'new=bar; chocolate=milk;;;', + {'new': 'bar', 'chocolate': 'milk'}, + 'chocolate=milk; cookie1=foo; cookie2=foo; new=bar' + ) + ] + ) + def test_existing_and_new_cookies_sent_in_request(self, new_cookies, new_cookies_dict, expected, httpbin): + r = http( + '--session', str(self.session_path), + '--print=H', + httpbin.url, + 'Cookie:' + new_cookies, + ) + # Note: cookies in response are in alphabetical order +> assert f'Cookie: {expected}' in r +E AssertionError: assert 'Cookie: chocolate=milk; cookie1=foo; cookie2=foo; new=bar' in 'GET / HTTP/1.1\r\nAccept: */*\r\nAccept-Encoding: gzip, deflate, br\r\nConnection: keep-alive\r\nCookie: cookie1=foo; cookie2=foo; new=bar; chocolate=milk\r\nHost: 127.0.0.1:59271\r\nUser-Agent: HTTPie/3.2.1\r\n\r\n' + +tests/test_sessions.py:485: AssertionError +----------------------------- Captured stderr call ----------------------------- +127.0.0.1 - - [01/Mar/2023 13:09:19] "GET / HTTP/1.1" 200 12144 +=============================== warnings summary =============================== +tests/test_downloads.py::TestDownloads::test_actual_download[http] + /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/collections/__init__.py:417: ResourceWarning: unclosed file <_io.BufferedReader name='/Users/editflores/editf-github/dd2480/DD2480-httpie/tests/fixtures/test.txt'> + field_names = tuple(map(_sys.intern, field_names)) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_httpie.py::test_headers_unset[http] +tests/test_uploads.py::TestMultipartFormDataFileUpload::test_multipart +tests/test_xml.py::test_invalid_xml[file4] +tests/test_xml.py::test_invalid_xml[file4] + /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/collections/__init__.py:451: ResourceWarning: unclosed file <_io.BufferedReader name='/Users/editflores/editf-github/dd2480/DD2480-httpie/tests/fixtures/test.txt'> + result = self._make(_map(kwds.pop, field_names, self)) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_auth.py: 10 warnings +tests/test_compress.py: 7 warnings +tests/test_downloads.py: 1 warning +tests/test_errors.py: 2 warnings +tests/test_httpie.py: 26 warnings +tests/test_json.py: 1 warning +tests/test_cli.py: 2 warnings +tests/test_ssl.py: 19 warnings + /Users/editflores/editf-github/dd2480/DD2480-httpie/venv/lib/python3.11/site-packages/pytest_httpbin/serve.py:65: DeprecationWarning: ssl.wrap_socket() is deprecated, use SSLContext.wrap_socket() + ssock = ssl.wrap_socket( + +tests/test_auth.py: 10 warnings +tests/test_compress.py: 7 warnings +tests/test_downloads.py: 1 warning +tests/test_errors.py: 2 warnings +tests/test_httpie.py: 26 warnings +tests/test_json.py: 1 warning +tests/test_cli.py: 2 warnings +tests/test_ssl.py: 19 warnings + /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/ssl.py:1438: DeprecationWarning: ssl.PROTOCOL_TLS is deprecated + context = SSLContext(ssl_version) + +tests/test_auth.py::test_basic_auth[https] + /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socketserver.py:348: ResourceWarning: unclosed + self.finish_request(request, client_address) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_auth.py::test_digest_auth[https---auth-type] + /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socketserver.py:348: ResourceWarning: unclosed + self.finish_request(request, client_address) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_auth.py::test_digest_auth[https---auth-type] + /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socketserver.py:348: ResourceWarning: unclosed + self.finish_request(request, client_address) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_auth.py::test_digest_auth[https--A] + /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socketserver.py:348: ResourceWarning: unclosed + self.finish_request(request, client_address) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_auth.py::test_digest_auth[https--A] + /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socketserver.py:348: ResourceWarning: unclosed + self.finish_request(request, client_address) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_auth.py::test_bearer_auth[https-token_1] + /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socketserver.py:348: ResourceWarning: unclosed + self.finish_request(request, client_address) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_auth.py::test_bearer_auth[https-long_tokenlong_tokenlong_tokenlong_tokenlong_token] + /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socketserver.py:348: ResourceWarning: unclosed + self.finish_request(request, client_address) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_auth.py::test_bearer_auth[https-user:style] + /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socketserver.py:348: ResourceWarning: unclosed + self.finish_request(request, client_address) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_auth.py::test_credentials_in_url[https] + /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socketserver.py:348: ResourceWarning: unclosed + self.finish_request(request, client_address) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_auth.py::test_credentials_in_url_auth_flag_has_priority[https] + /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socketserver.py:348: ResourceWarning: unclosed + self.finish_request(request, client_address) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_auth.py::test_netrc[https] + /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socketserver.py:348: ResourceWarning: unclosed + self.finish_request(request, client_address) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_auth.py::test_ignore_netrc[https] + /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socketserver.py:348: ResourceWarning: unclosed + self.finish_request(request, client_address) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_compress.py::test_compress_skip_negative_ratio[https] + /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socketserver.py:348: ResourceWarning: unclosed + self.finish_request(request, client_address) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_compress.py::test_compress_force_with_negative_ratio[https] + /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socketserver.py:348: ResourceWarning: unclosed + self.finish_request(request, client_address) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_compress.py::test_compress_json[https] + /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socketserver.py:348: ResourceWarning: unclosed + self.finish_request(request, client_address) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_compress.py::test_compress_form[https] + /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socketserver.py:348: ResourceWarning: unclosed + self.finish_request(request, client_address) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_compress.py::test_compress_raw[https] + /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socketserver.py:348: ResourceWarning: unclosed + self.finish_request(request, client_address) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_compress.py::test_compress_stdin[https] + /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socketserver.py:348: ResourceWarning: unclosed + self.finish_request(request, client_address) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_compress.py::test_compress_file[https] + /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socketserver.py:348: ResourceWarning: unclosed + self.finish_request(request, client_address) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_downloads.py: 1 warning +tests/test_httpie.py: 1 warning +tests/test_offline.py: 1 warning +tests/test_sessions.py: 1 warning +tests/test_uploads.py: 5 warnings +tests/test_windows.py: 1 warning + /Users/editflores/editf-github/dd2480/DD2480-httpie/httpie/cli/argparser.py:159: ResourceWarning: unclosed file <_io.BufferedReader name='/Users/editflores/editf-github/dd2480/DD2480-httpie/tests/fixtures/test.txt'> + self.args, no_options = super().parse_known_args(args, namespace) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_downloads.py::TestDownloads::test_actual_download[https] + /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socketserver.py:348: ResourceWarning: unclosed + self.finish_request(request, client_address) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_errors.py::test_max_headers_limit[https] + /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socketserver.py:348: ResourceWarning: unclosed + self.finish_request(request, client_address) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_httpie.py::test_GET[https] + /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socketserver.py:348: ResourceWarning: unclosed + self.finish_request(request, client_address) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_httpie.py::test_DELETE[https] + /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socketserver.py:348: ResourceWarning: unclosed + self.finish_request(request, client_address) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_httpie.py::test_PUT[https] + /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socketserver.py:348: ResourceWarning: unclosed + self.finish_request(request, client_address) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_httpie.py::test_POST_JSON_data[https] + /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socketserver.py:348: ResourceWarning: unclosed + self.finish_request(request, client_address) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_httpie.py::test_POST_form[https] + /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socketserver.py:348: ResourceWarning: unclosed + self.finish_request(request, client_address) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_httpie.py::test_POST_form_multiple_values[https] + /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socketserver.py:348: ResourceWarning: unclosed + self.finish_request(request, client_address) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_httpie.py::test_POST_raw[https] + /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socketserver.py:348: ResourceWarning: unclosed + self.finish_request(request, client_address) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_httpie.py::test_POST_stdin[https] + /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socketserver.py:348: ResourceWarning: unclosed + self.finish_request(request, client_address) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_httpie.py::test_POST_file[https] + /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socketserver.py:348: ResourceWarning: unclosed + self.finish_request(request, client_address) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_httpie.py::test_headers_unset[https] + /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socketserver.py:348: ResourceWarning: unclosed + self.finish_request(request, client_address) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_httpie.py::test_headers_unset[https] + /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/collections/__init__.py:442: ResourceWarning: unclosed file <_io.BufferedReader name='/Users/editflores/editf-github/dd2480/DD2480-httpie/tests/fixtures/test.txt'> + result = tuple_new(cls, iterable) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_httpie.py::test_headers_unset[https] + /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socketserver.py:348: ResourceWarning: unclosed + self.finish_request(request, client_address) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_httpie.py::test_headers_empty_value[https] + /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socketserver.py:348: ResourceWarning: unclosed + self.finish_request(request, client_address) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_httpie.py::test_headers_empty_value[https] + /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socketserver.py:348: ResourceWarning: unclosed + self.finish_request(request, client_address) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_httpie.py::test_headers_omit[https] + /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socketserver.py:348: ResourceWarning: unclosed + self.finish_request(request, client_address) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_httpie.py::test_headers_multiple_omit[https] + /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socketserver.py:348: ResourceWarning: unclosed + self.finish_request(request, client_address) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_httpie.py::test_headers_same_after_omit[https] + /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socketserver.py:348: ResourceWarning: unclosed + self.finish_request(request, client_address) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_httpie.py::test_headers_fully_omit[https] + /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socketserver.py:348: ResourceWarning: unclosed + self.finish_request(request, client_address) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_httpie.py::test_headers_multiple_values[https] + /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socketserver.py:348: ResourceWarning: unclosed + self.finish_request(request, client_address) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_httpie.py::test_headers_multiple_values_repeated[https] + /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socketserver.py:348: ResourceWarning: unclosed + self.finish_request(request, client_address) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_httpie.py::test_headers_multiple_values_with_empty[https-headers0-,bar] + /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socketserver.py:348: ResourceWarning: unclosed + self.finish_request(request, client_address) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_httpie.py::test_headers_multiple_values_with_empty[https-headers1-bar,] + /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socketserver.py:348: ResourceWarning: unclosed + self.finish_request(request, client_address) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_httpie.py::test_headers_multiple_values_with_empty[https-headers2-bar,,baz] + /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socketserver.py:348: ResourceWarning: unclosed + self.finish_request(request, client_address) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_httpie.py::test_headers_multiple_values_mixed[https] + /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socketserver.py:348: ResourceWarning: unclosed + self.finish_request(request, client_address) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_httpie.py::test_headers_preserve_prepared_headers[https] + /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socketserver.py:348: ResourceWarning: unclosed + self.finish_request(request, client_address) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_httpie.py::test_json_input_preserve_order[https] + /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socketserver.py:348: ResourceWarning: unclosed + self.finish_request(request, client_address) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_json.py::test_nested_json_sparse_array[https] + /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socketserver.py:348: ResourceWarning: unclosed + self.finish_request(request, client_address) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_binary.py::TestBinaryResponseData::test_binary_included_and_correct_when_suitable +tests/test_binary.py::TestBinaryResponseData::test_binary_included_and_correct_when_suitable + /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/collections/__init__.py:442: ResourceWarning: unclosed file <_io.FileIO name='/Users/editflores/editf-github/dd2480/DD2480-httpie/tests/fixtures/test.bin' mode='rb' closefd=True> + result = tuple_new(cls, iterable) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_cli.py::TestSchemes::test_default_scheme_option + /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socketserver.py:348: ResourceWarning: unclosed + self.finish_request(request, client_address) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_cli.py::TestSchemes::test_scheme_when_invoked_as_https + /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socketserver.py:348: ResourceWarning: unclosed + self.finish_request(request, client_address) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_cookie.py::TestIntegration::test_cookie_parser + /Users/editflores/editf-github/dd2480/DD2480-httpie/tests/test_cookie.py:19: DeprecationWarning: setDaemon() is deprecated, set the daemon attribute instead + self.mock_server_thread.setDaemon(True) + +tests/test_cookie_on_redirects.py::test_explicit_user_set_cookie[remote_httpbin] + /Users/editflores/editf-github/dd2480/DD2480-httpie/httpie/core.py:100: ResourceWarning: unclosed + exit_status = main_program( + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_cookie_on_redirects.py::test_explicit_user_set_cookie_in_session[remote_httpbin] + /Users/editflores/editf-github/dd2480/DD2480-httpie/httpie/core.py:100: ResourceWarning: unclosed + exit_status = main_program( + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_cookie_on_redirects.py::test_saved_user_set_cookie_in_session[remote_httpbin] + /Users/editflores/editf-github/dd2480/DD2480-httpie/httpie/core.py:100: ResourceWarning: unclosed + exit_status = main_program( + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_cookie_on_redirects.py::test_explicit_user_set_headers[True-remote_httpbin] + /Users/editflores/editf-github/dd2480/DD2480-httpie/httpie/core.py:100: ResourceWarning: unclosed + exit_status = main_program( + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_cookie_on_redirects.py::test_explicit_user_set_headers[False-remote_httpbin] + /Users/editflores/editf-github/dd2480/DD2480-httpie/httpie/core.py:100: ResourceWarning: unclosed + exit_status = main_program( + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_cookie_on_redirects.py::test_server_set_cookie_on_redirect_different_domain[True] + /Users/editflores/editf-github/dd2480/DD2480-httpie/venv/lib/python3.11/site-packages/_pytest/fixtures.py:917: ResourceWarning: unclosed + next(it) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_cookie_on_redirects.py::test_server_set_cookie_on_redirect_different_domain[False] + /Users/editflores/editf-github/dd2480/DD2480-httpie/venv/lib/python3.11/site-packages/_pytest/fixtures.py:917: ResourceWarning: unclosed + next(it) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_cookie_on_redirects.py::test_saved_session_cookies_on_different_domain + /Users/editflores/editf-github/dd2480/DD2480-httpie/httpie/core.py:100: ResourceWarning: unclosed + exit_status = main_program( + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_cookie_on_redirects.py::test_saved_session_cookies_on_redirect[httpbin-remote_httpbin-remote_httpbin-False] + /Users/editflores/editf-github/dd2480/DD2480-httpie/httpie/core.py:100: ResourceWarning: unclosed + exit_status = main_program( + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_cookie_on_redirects.py::test_saved_session_cookies_on_redirect[httpbin-httpbin-remote_httpbin-False] + /Users/editflores/editf-github/dd2480/DD2480-httpie/httpie/core.py:100: ResourceWarning: unclosed + exit_status = main_program( + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_cookie_on_redirects.py::test_saved_session_cookies_on_redirect[httpbin-remote_httpbin-httpbin-True] + /Users/editflores/editf-github/dd2480/DD2480-httpie/httpie/core.py:100: ResourceWarning: unclosed + exit_status = main_program( + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_cookie_on_redirects.py::test_saved_session_cookie_pool + /Users/editflores/editf-github/dd2480/DD2480-httpie/httpie/core.py:100: ResourceWarning: unclosed + exit_status = main_program( + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_cookie_on_redirects.py::test_saved_session_cookie_pool + /Users/editflores/editf-github/dd2480/DD2480-httpie/httpie/core.py:100: ResourceWarning: unclosed + exit_status = main_program( + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_cookie_on_redirects.py::test_saved_session_cookie_pool + /Users/editflores/editf-github/dd2480/DD2480-httpie/httpie/core.py:100: ResourceWarning: unclosed + exit_status = main_program( + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_downloads.py::TestDownloads::test_download_with_redirect_original_url_used_for_filename + /Users/editflores/editf-github/dd2480/DD2480-httpie/httpie/core.py:100: ResourceWarning: unclosed file <_io.FileIO name='1.json' mode='ab+' closefd=True> + exit_status = main_program( + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_encoding.py::test_terminal_output_response_charset_detection[big5-\u5377\u9996\u5377\u9996\u5377\u9996\u5377\u9996\u5377\u5377\u9996\u5377\u9996\u5377\u9996\u5377\u9996\u5377\u9996\u5377\u9996\u5377\u9996\u5377\u9996\u5377\u9996\u5377\u9996\u5377\u9996\u5377\u9996\u5377\u9996] + /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/encodings/cp852.py:25: ResourceWarning: unclosed file <_io.TextIOWrapper name='/var/folders/fl/3_wfz5td61943_0_wf9ww6vw0000gn/T/httpie_stderrqfj_tyc7' mode='w+t' encoding='utf-8'> + class StreamWriter(Codec,codecs.StreamWriter): + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_encoding.py: 12 warnings +tests/test_stream.py: 8 warnings + /Users/editflores/editf-github/dd2480/DD2480-httpie/venv/lib/python3.11/site-packages/responses/__init__.py:547: DeprecationWarning: stream argument is deprecated. Use stream parameter in request directly + warn( + +tests/test_httpie.py::test_response_headers_multiple + /Users/editflores/editf-github/dd2480/DD2480-httpie/httpie/core.py:100: ResourceWarning: unclosed + exit_status = main_program( + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_httpie.py::test_response_headers_multiple + /Users/editflores/editf-github/dd2480/DD2480-httpie/venv/lib/python3.11/site-packages/_pytest/fixtures.py:917: ResourceWarning: unclosed + next(it) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_httpie.py::test_response_headers_multiple_repeated + /Users/editflores/editf-github/dd2480/DD2480-httpie/httpie/core.py:100: ResourceWarning: unclosed + exit_status = main_program( + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_httpie.py::test_response_headers_multiple_repeated + /Users/editflores/editf-github/dd2480/DD2480-httpie/venv/lib/python3.11/site-packages/_pytest/fixtures.py:917: ResourceWarning: unclosed + next(it) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_httpie.py::test_response_headers_multiple_representation[format] + /Users/editflores/editf-github/dd2480/DD2480-httpie/httpie/core.py:100: ResourceWarning: unclosed + exit_status = main_program( + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_httpie.py::test_response_headers_multiple_representation[format] + /Users/editflores/editf-github/dd2480/DD2480-httpie/venv/lib/python3.11/site-packages/_pytest/fixtures.py:917: ResourceWarning: unclosed + next(it) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_httpie.py::test_response_headers_multiple_representation[none] + /Users/editflores/editf-github/dd2480/DD2480-httpie/httpie/core.py:100: ResourceWarning: unclosed + exit_status = main_program( + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_httpie.py::test_response_headers_multiple_representation[none] + /Users/editflores/editf-github/dd2480/DD2480-httpie/venv/lib/python3.11/site-packages/_pytest/fixtures.py:917: ResourceWarning: unclosed + next(it) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_json.py::test_json_formatter_with_body_preceded_by_non_json_data[all-json_data1-)]}',\\n] + /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/collections/__init__.py:451: ResourceWarning: unclosed file <_io.TextIOWrapper name='/var/folders/fl/3_wfz5td61943_0_wf9ww6vw0000gn/T/httpie_stderr4_50b8eo' mode='w+t' encoding='utf-8'> + result = self._make(_map(kwds.pop, field_names, self)) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_json.py::test_duplicate_keys_support_from_input_file +tests/test_json.py::test_simple_json_arguments_with_non_json[1] + /Users/editflores/editf-github/dd2480/DD2480-httpie/httpie/cli/argparser.py:159: ResourceWarning: unclosed file <_io.BufferedReader name='/Users/editflores/editf-github/dd2480/DD2480-httpie/tests/fixtures/test_with_dupe_keys.json'> + self.args, no_options = super().parse_known_args(args, namespace) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_output.py::TestQuietFlag::test_quiet[quiet_flags1] + /Users/editflores/editf-github/dd2480/DD2480-httpie/httpie/cli/argparser.py:157: ResourceWarning: unclosed file <_io.TextIOWrapper name=29 mode='w+t' encoding='utf-8'> + self.env = env + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_output.py::TestQuietFlag::test_quiet[quiet_flags2] +tests/test_output.py::TestQuietFlag::test_quiet_with_password_prompt[quiet_flags1] +tests/test_output.py::TestQuietFlag::test_quiet_with_output_redirection[False-quiet_flags1] + /Users/editflores/editf-github/dd2480/DD2480-httpie/httpie/cli/argparser.py:157: ResourceWarning: unclosed file <_io.TextIOWrapper name=33 mode='w+t' encoding='utf-8'> + self.env = env + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_output.py::TestQuietFlag::test_quiet[quiet_flags3] +tests/test_output.py::TestQuietFlag::test_quiet_with_password_prompt[quiet_flags2] +tests/test_output.py::TestQuietFlag::test_quiet_with_explicit_output_options[-h-quiet_flags1] +tests/test_output.py::TestQuietFlag::test_quiet_with_output_redirection[False-quiet_flags2] + /Users/editflores/editf-github/dd2480/DD2480-httpie/httpie/cli/argparser.py:157: ResourceWarning: unclosed file <_io.TextIOWrapper name=34 mode='w+t' encoding='utf-8'> + self.env = env + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_output.py: 10 warnings + /Users/editflores/editf-github/dd2480/DD2480-httpie/httpie/cli/argparser.py:157: ResourceWarning: unclosed file <_io.TextIOWrapper name=27 mode='w+t' encoding='utf-8'> + self.env = env + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_output.py::TestQuietFlag::test_quiet_with_check_status_non_zero + /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/ast.py:50: ResourceWarning: unclosed file <_io.TextIOWrapper name='/var/folders/fl/3_wfz5td61943_0_wf9ww6vw0000gn/T/httpie_stderrba4cegys' mode='w+t' encoding='utf-8'> + return compile(source, filename, mode, flags, + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_output.py::TestQuietFlag::test_quiet_with_check_status_non_zero_pipe + /Users/editflores/editf-github/dd2480/DD2480-httpie/httpie/cli/argparser.py:157: ResourceWarning: unclosed file <_io.TextIOWrapper name=32 mode='w+t' encoding='utf-8'> + self.env = env + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_output.py::TestQuietFlag::test_quiet_quiet_with_check_status_non_zero_pipe + /Users/editflores/editf-github/dd2480/DD2480-httpie/httpie/cli/argparser.py:157: ResourceWarning: unclosed file <_io.TextIOWrapper name=28 mode='w+t' encoding='utf-8'> + self.env = env + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_output.py::TestQuietFlag::test_quiet_on_python_warnings[flags0-1] +tests/test_output.py::TestQuietFlag::test_quiet_on_python_warnings[flags1-1] +tests/test_output.py::TestQuietFlag::test_quiet_on_python_warnings[flags2-0] + /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/unittest/mock.py:1369: PytestRemovedIn8Warning: Passing None has been deprecated. + See https://docs.pytest.org/en/latest/how-to/capture-warnings.html#additional-use-cases-of-warnings-in-tests for alternatives in common use cases. + return func(*newargs, **newkeywargs) + +tests/test_output.py::TestQuietFlag::test_quiet_with_password_prompt[quiet_flags3] +tests/test_output.py::TestQuietFlag::test_quiet_with_explicit_output_options[-h-quiet_flags2] +tests/test_output.py::TestQuietFlag::test_quiet_with_explicit_output_options[-b-quiet_flags1] +tests/test_output.py::TestQuietFlag::test_quiet_with_output_redirection[False-quiet_flags3] + /Users/editflores/editf-github/dd2480/DD2480-httpie/httpie/cli/argparser.py:157: ResourceWarning: unclosed file <_io.TextIOWrapper name=35 mode='w+t' encoding='utf-8'> + self.env = env + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_output.py::TestQuietFlag::test_quiet_with_explicit_output_options[-h-quiet_flags3] +tests/test_output.py::TestQuietFlag::test_quiet_with_explicit_output_options[-b-quiet_flags2] +tests/test_output.py::TestQuietFlag::test_quiet_with_explicit_output_options[-v-quiet_flags1] + /Users/editflores/editf-github/dd2480/DD2480-httpie/httpie/cli/argparser.py:157: ResourceWarning: unclosed file <_io.TextIOWrapper name=36 mode='w+t' encoding='utf-8'> + self.env = env + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_output.py::TestQuietFlag::test_quiet_with_explicit_output_options[-b-quiet_flags3] +tests/test_output.py::TestQuietFlag::test_quiet_with_explicit_output_options[-v-quiet_flags2] +tests/test_output.py::TestQuietFlag::test_quiet_with_explicit_output_options[-p=hH-quiet_flags1] + /Users/editflores/editf-github/dd2480/DD2480-httpie/httpie/cli/argparser.py:157: ResourceWarning: unclosed file <_io.TextIOWrapper name=37 mode='w+t' encoding='utf-8'> + self.env = env + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_output.py::TestQuietFlag::test_quiet_with_explicit_output_options[-v-quiet_flags3] +tests/test_output.py::TestQuietFlag::test_quiet_with_explicit_output_options[-p=hH-quiet_flags2] +tests/test_output.py::TestQuietFlag::test_quiet_with_output_redirection[True-quiet_flags1] + /Users/editflores/editf-github/dd2480/DD2480-httpie/httpie/cli/argparser.py:157: ResourceWarning: unclosed file <_io.TextIOWrapper name=38 mode='w+t' encoding='utf-8'> + self.env = env + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_output.py::TestQuietFlag::test_quiet_with_explicit_output_options[-p=hH-quiet_flags3] +tests/test_output.py::TestQuietFlag::test_quiet_with_output_redirection[True-quiet_flags2] + /Users/editflores/editf-github/dd2480/DD2480-httpie/httpie/cli/argparser.py:157: ResourceWarning: unclosed file <_io.TextIOWrapper name=39 mode='w+t' encoding='utf-8'> + self.env = env + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_output.py::TestQuietFlag::test_quiet_with_output_redirection[True-quiet_flags3] + /Users/editflores/editf-github/dd2480/DD2480-httpie/httpie/cli/argparser.py:157: ResourceWarning: unclosed file <_io.TextIOWrapper name=40 mode='w+t' encoding='utf-8'> + self.env = env + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_output.py::test_ensure_status_code_is_shown_on_all_themes[-auto] + /Users/editflores/editf-github/dd2480/DD2480-httpie/venv/lib/python3.11/site-packages/_pytest/fixtures.py:917: ResourceWarning: unclosed + next(it) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_output.py::test_ensure_status_code_is_shown_on_all_themes[-pie] + /Users/editflores/editf-github/dd2480/DD2480-httpie/venv/lib/python3.11/site-packages/_pytest/fixtures.py:917: ResourceWarning: unclosed + next(it) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_output.py::test_ensure_status_code_is_shown_on_all_themes[-pie-dark] + /Users/editflores/editf-github/dd2480/DD2480-httpie/venv/lib/python3.11/site-packages/_pytest/fixtures.py:917: ResourceWarning: unclosed + next(it) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_output.py::test_ensure_status_code_is_shown_on_all_themes[-pie-light] + /Users/editflores/editf-github/dd2480/DD2480-httpie/venv/lib/python3.11/site-packages/_pytest/fixtures.py:917: ResourceWarning: unclosed + next(it) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_output.py::test_ensure_status_code_is_shown_on_all_themes[-solarized] + /Users/editflores/editf-github/dd2480/DD2480-httpie/venv/lib/python3.11/site-packages/_pytest/fixtures.py:917: ResourceWarning: unclosed + next(it) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_output.py::test_ensure_status_code_is_shown_on_all_themes[ -auto] + /Users/editflores/editf-github/dd2480/DD2480-httpie/venv/lib/python3.11/site-packages/_pytest/fixtures.py:917: ResourceWarning: unclosed + next(it) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_output.py::test_ensure_status_code_is_shown_on_all_themes[ -pie] + /Users/editflores/editf-github/dd2480/DD2480-httpie/venv/lib/python3.11/site-packages/_pytest/fixtures.py:917: ResourceWarning: unclosed + next(it) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_output.py::test_ensure_status_code_is_shown_on_all_themes[ -pie-dark] + /Users/editflores/editf-github/dd2480/DD2480-httpie/venv/lib/python3.11/site-packages/_pytest/fixtures.py:917: ResourceWarning: unclosed + next(it) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_output.py::test_ensure_status_code_is_shown_on_all_themes[ -pie-light] + /Users/editflores/editf-github/dd2480/DD2480-httpie/venv/lib/python3.11/site-packages/_pytest/fixtures.py:917: ResourceWarning: unclosed + next(it) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_output.py::test_ensure_status_code_is_shown_on_all_themes[ -solarized] + /Users/editflores/editf-github/dd2480/DD2480-httpie/venv/lib/python3.11/site-packages/_pytest/fixtures.py:917: ResourceWarning: unclosed + next(it) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_output.py::test_ensure_status_code_is_shown_on_all_themes[ OK-auto] + /Users/editflores/editf-github/dd2480/DD2480-httpie/venv/lib/python3.11/site-packages/_pytest/fixtures.py:917: ResourceWarning: unclosed + next(it) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_output.py::test_ensure_status_code_is_shown_on_all_themes[ OK-pie] + /Users/editflores/editf-github/dd2480/DD2480-httpie/venv/lib/python3.11/site-packages/_pytest/fixtures.py:917: ResourceWarning: unclosed + next(it) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_output.py::test_ensure_status_code_is_shown_on_all_themes[ OK-pie-dark] + /Users/editflores/editf-github/dd2480/DD2480-httpie/venv/lib/python3.11/site-packages/_pytest/fixtures.py:917: ResourceWarning: unclosed + next(it) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_output.py::test_ensure_status_code_is_shown_on_all_themes[ OK-pie-light] + /Users/editflores/editf-github/dd2480/DD2480-httpie/venv/lib/python3.11/site-packages/_pytest/fixtures.py:917: ResourceWarning: unclosed + next(it) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_output.py::test_ensure_status_code_is_shown_on_all_themes[ OK-solarized] + /Users/editflores/editf-github/dd2480/DD2480-httpie/venv/lib/python3.11/site-packages/_pytest/fixtures.py:917: ResourceWarning: unclosed + next(it) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_output.py::test_ensure_status_code_is_shown_on_all_themes[ OK -auto] + /Users/editflores/editf-github/dd2480/DD2480-httpie/venv/lib/python3.11/site-packages/_pytest/fixtures.py:917: ResourceWarning: unclosed + next(it) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_output.py::test_ensure_status_code_is_shown_on_all_themes[ OK -pie] + /Users/editflores/editf-github/dd2480/DD2480-httpie/venv/lib/python3.11/site-packages/_pytest/fixtures.py:917: ResourceWarning: unclosed + next(it) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_output.py::test_ensure_status_code_is_shown_on_all_themes[ OK -pie-dark] + /Users/editflores/editf-github/dd2480/DD2480-httpie/venv/lib/python3.11/site-packages/_pytest/fixtures.py:917: ResourceWarning: unclosed + next(it) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_output.py::test_ensure_status_code_is_shown_on_all_themes[ OK -pie-light] + /Users/editflores/editf-github/dd2480/DD2480-httpie/venv/lib/python3.11/site-packages/_pytest/fixtures.py:917: ResourceWarning: unclosed + next(it) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_output.py::test_ensure_status_code_is_shown_on_all_themes[ OK -solarized] + /Users/editflores/editf-github/dd2480/DD2480-httpie/venv/lib/python3.11/site-packages/_pytest/fixtures.py:917: ResourceWarning: unclosed + next(it) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_output.py::test_ensure_status_code_is_shown_on_all_themes[ CUSTOM -auto] + /Users/editflores/editf-github/dd2480/DD2480-httpie/venv/lib/python3.11/site-packages/_pytest/fixtures.py:917: ResourceWarning: unclosed + next(it) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_output.py::test_ensure_status_code_is_shown_on_all_themes[ CUSTOM -pie] + /Users/editflores/editf-github/dd2480/DD2480-httpie/venv/lib/python3.11/site-packages/_pytest/fixtures.py:917: ResourceWarning: unclosed + next(it) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_output.py::test_ensure_status_code_is_shown_on_all_themes[ CUSTOM -pie-dark] + /Users/editflores/editf-github/dd2480/DD2480-httpie/venv/lib/python3.11/site-packages/_pytest/fixtures.py:917: ResourceWarning: unclosed + next(it) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_output.py::test_ensure_status_code_is_shown_on_all_themes[ CUSTOM -pie-light] + /Users/editflores/editf-github/dd2480/DD2480-httpie/venv/lib/python3.11/site-packages/_pytest/fixtures.py:917: ResourceWarning: unclosed + next(it) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_output.py::test_ensure_status_code_is_shown_on_all_themes[ CUSTOM -solarized] + /Users/editflores/editf-github/dd2480/DD2480-httpie/venv/lib/python3.11/site-packages/_pytest/fixtures.py:917: ResourceWarning: unclosed + next(it) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_regressions.py::test_Host_header_overwrite +tests/test_uploads.py::TestRequestBodyFromFilePath::test_request_body_from_file_by_path_with_explicit_content_type + /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/collections/__init__.py:442: ResourceWarning: unclosed file <_io.FileIO name='/Users/editflores/editf-github/dd2480/DD2480-httpie/tests/fixtures/test.txt' mode='rb' closefd=True> + result = tuple_new(cls, iterable) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_sessions.py::TestSessionFlow::test_session_created_and_reused + /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/collections/__init__.py:451: ResourceWarning: unclosed file <_io.FileIO name='/var/folders/fl/3_wfz5td61943_0_wf9ww6vw0000gn/T/httpie_stderrgkanrp6h' mode='rb+' closefd=True> + result = self._make(_map(kwds.pop, field_names, self)) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_sessions.py::TestSession::test_download_in_session + /Users/editflores/editf-github/dd2480/DD2480-httpie/httpie/core.py:100: ResourceWarning: unclosed file <_io.FileIO name='get.json' mode='ab+' closefd=True> + exit_status = main_program( + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_sessions.py::TestExpiredCookies::test_expired_cookies +tests/test_sessions.py::TestExpiredCookies::test_expired_cookies +tests/test_sessions.py::TestExpiredCookies::test_expired_cookies + /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/importlib/metadata/__init__.py:120: ResourceWarning: unclosed file <_io.BufferedReader name='/Users/editflores/editf-github/dd2480/DD2480-httpie/tests/fixtures/test.txt'> + return line and not line.startswith('#') + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_sessions.py::TestCookieStorage::test_existing_and_new_cookies_sent_in_request[new=bar;chocolate=milk-new_cookies_dict1-chocolate=milk; cookie1=foo; cookie2=foo; new=bar] + /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/ast.py:50: ResourceWarning: unclosed file <_io.TextIOWrapper name=29 mode='w+t' encoding='utf-8'> + return compile(source, filename, mode, flags, + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_sessions.py::TestCookieStorage::test_existing_and_new_cookies_sent_in_request[new=bar;chocolate=milk-new_cookies_dict1-chocolate=milk; cookie1=foo; cookie2=foo; new=bar] + /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/ast.py:50: ResourceWarning: unclosed file <_io.TextIOWrapper name='/var/folders/fl/3_wfz5td61943_0_wf9ww6vw0000gn/T/httpie_stderrgx5l8z1p' mode='w+t' encoding='utf-8'> + return compile(source, filename, mode, flags, + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_sessions.py::TestCookieStorage::test_existing_and_new_cookies_sent_in_request[new=bar;chocolate=milk-new_cookies_dict1-chocolate=milk; cookie1=foo; cookie2=foo; new=bar] + /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/ast.py:50: ResourceWarning: unclosed file <_io.TextIOWrapper name='/var/folders/fl/3_wfz5td61943_0_wf9ww6vw0000gn/T/httpie_stderr5igopgcp' mode='w+t' encoding='utf-8'> + return compile(source, filename, mode, flags, + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_sessions.py::test_secure_cookies_on_localhost[localhost_http_server-expected_cookies0] + /Users/editflores/editf-github/dd2480/DD2480-httpie/venv/lib/python3.11/site-packages/_pytest/fixtures.py:917: ResourceWarning: unclosed + next(it) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_sessions.py::test_secure_cookies_on_localhost[remote_httpbin-expected_cookies1] + /Users/editflores/editf-github/dd2480/DD2480-httpie/httpie/core.py:100: ResourceWarning: unclosed + exit_status = main_program( + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_sessions.py::test_secure_cookies_on_localhost[remote_httpbin-expected_cookies1] + /Users/editflores/editf-github/dd2480/DD2480-httpie/httpie/core.py:100: ResourceWarning: unclosed + exit_status = main_program( + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_ssl.py::test_ssl_version[ssl2.3] + /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socketserver.py:348: ResourceWarning: unclosed + self.finish_request(request, client_address) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_ssl.py::test_ssl_version[tls1] + /Users/editflores/editf-github/dd2480/DD2480-httpie/venv/lib/python3.11/site-packages/urllib3/util/ssl_.py:290: DeprecationWarning: ssl.PROTOCOL_TLSv1 is deprecated + context = SSLContext(ssl_version) + +tests/test_ssl.py::test_ssl_version[tls1.1] + /Users/editflores/editf-github/dd2480/DD2480-httpie/venv/lib/python3.11/site-packages/urllib3/util/ssl_.py:290: DeprecationWarning: ssl.PROTOCOL_TLSv1_1 is deprecated + context = SSLContext(ssl_version) + +tests/test_ssl.py::test_ssl_version[tls1.2] + /Users/editflores/editf-github/dd2480/DD2480-httpie/venv/lib/python3.11/site-packages/urllib3/util/ssl_.py:290: DeprecationWarning: ssl.PROTOCOL_TLSv1_2 is deprecated + context = SSLContext(ssl_version) + +tests/test_ssl.py::test_ssl_version[tls1.2] + /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socketserver.py:348: ResourceWarning: unclosed + self.finish_request(request, client_address) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_ssl.py::TestClientCert::test_cert_and_key + /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socketserver.py:348: ResourceWarning: unclosed + self.finish_request(request, client_address) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_ssl.py::TestClientCert::test_cert_pem + /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socketserver.py:348: ResourceWarning: unclosed + self.finish_request(request, client_address) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_ssl.py::TestServerCert::test_verify_no_OK +tests/test_ssl.py::TestServerCert::test_verify_false_OK[false] +tests/test_ssl.py::TestServerCert::test_verify_false_OK[fALse] + /Users/editflores/editf-github/dd2480/DD2480-httpie/venv/lib/python3.11/site-packages/urllib3/connectionpool.py:1045: InsecureRequestWarning: Unverified HTTPS request is being made to host '127.0.0.1'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings + warnings.warn( + +tests/test_ssl.py::TestServerCert::test_verify_no_OK + /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socketserver.py:348: ResourceWarning: unclosed + self.finish_request(request, client_address) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_ssl.py::TestServerCert::test_verify_false_OK[false] + /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socketserver.py:348: ResourceWarning: unclosed + self.finish_request(request, client_address) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_ssl.py::TestServerCert::test_verify_false_OK[fALse] + /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socketserver.py:348: ResourceWarning: unclosed + self.finish_request(request, client_address) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_ssl.py::TestServerCert::test_verify_custom_ca_bundle_path + /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socketserver.py:348: ResourceWarning: unclosed + self.finish_request(request, client_address) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_ssl.py::test_ciphers + /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socketserver.py:348: ResourceWarning: unclosed + self.finish_request(request, client_address) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_ssl.py::test_password_protected_cert_prompt + /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socketserver.py:348: ResourceWarning: unclosed + self.finish_request(request, client_address) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_ssl.py::test_password_protected_cert_cli_arg + /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/socketserver.py:348: ResourceWarning: unclosed + self.finish_request(request, client_address) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_stream.py::test_auto_streaming[extras0-3] + /Users/editflores/editf-github/dd2480/DD2480-httpie/venv/lib/python3.11/site-packages/_pytest/fixtures.py:917: ResourceWarning: unclosed + next(it) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_stream.py::test_auto_streaming[extras1-3] + /Users/editflores/editf-github/dd2480/DD2480-httpie/venv/lib/python3.11/site-packages/_pytest/fixtures.py:917: ResourceWarning: unclosed + next(it) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_stream.py::test_auto_streaming[extras2-1] + /Users/editflores/editf-github/dd2480/DD2480-httpie/venv/lib/python3.11/site-packages/_pytest/fixtures.py:917: ResourceWarning: unclosed + next(it) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_stream.py::test_streaming_encoding_detection + /Users/editflores/editf-github/dd2480/DD2480-httpie/venv/lib/python3.11/site-packages/_pytest/fixtures.py:917: ResourceWarning: unclosed + next(it) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_tokens.py::test_verbose_chunked + /Users/editflores/editf-github/dd2480/DD2480-httpie/httpie/core.py:100: ResourceWarning: unclosed + exit_status = main_program( + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_uploads.py::test_chunked_form + /Users/editflores/editf-github/dd2480/DD2480-httpie/httpie/core.py:100: ResourceWarning: unclosed + exit_status = main_program( + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_uploads.py::test_chunked_raw + /Users/editflores/editf-github/dd2480/DD2480-httpie/httpie/core.py:100: ResourceWarning: unclosed + exit_status = main_program( + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +tests/test_uploads.py::TestMultipartFormDataFileUpload::test_multipart + /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/collections/__init__.py:451: ResourceWarning: unclosed file <_io.FileIO name='/Users/editflores/editf-github/dd2480/DD2480-httpie/tests/fixtures/test.txt' mode='rb' closefd=True> + result = self._make(_map(kwds.pop, field_names, self)) + Enable tracemalloc to get traceback where the object was allocated. + See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. + +-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html +=========================== short test summary info ============================ +FAILED tests/test_cli.py::test_url_colon_slash_slash_only - AssertionError: a... +FAILED tests/test_output.py::TestQuietFlag::test_quiet_with_check_status_non_zero +FAILED tests/test_output.py::TestQuietFlag::test_quiet_with_check_status_non_zero_pipe +FAILED tests/test_output.py::TestQuietFlag::test_quiet_quiet_with_check_status_non_zero_pipe +FAILED tests/test_sessions.py::TestCookieStorage::test_existing_and_new_cookies_sent_in_request[new=bar;chocolate=milk-new_cookies_dict1-chocolate=milk; cookie1=foo; cookie2=foo; new=bar] +FAILED tests/test_sessions.py::TestCookieStorage::test_existing_and_new_cookies_sent_in_request[new=bar; chocolate=milk-new_cookies_dict2-chocolate=milk; cookie1=foo; cookie2=foo; new=bar] +FAILED tests/test_sessions.py::TestCookieStorage::test_existing_and_new_cookies_sent_in_request[new=bar; chocolate=milk;;;-new_cookies_dict4-chocolate=milk; cookie1=foo; cookie2=foo; new=bar] += 7 failed, 1009 passed, 6 skipped, 3 xfailed, 1 xpassed, 354 warnings in 211.95s (0:03:31) = From 0ba836eb3010c53c1cd063d2845695e0e5b612ec Mon Sep 17 00:00:00 2001 From: Sanjin Date: Wed, 1 Mar 2023 23:20:21 +0100 Subject: [PATCH 07/47] Fix: Fixed editt command not saving values properly --- httpie/cli/argtemplate.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/httpie/cli/argtemplate.py b/httpie/cli/argtemplate.py index 49ee81b41a..ef5199938c 100644 --- a/httpie/cli/argtemplate.py +++ b/httpie/cli/argtemplate.py @@ -52,10 +52,22 @@ def edit_json_template(args): template_item = args.pop(0) template_value = args.pop(0) updated_template = {} + if template_name in stored_templates: updated_template = stored_templates.pop(template_name) + + else: + raise Exception("Template doesn't exist") + + data_dict = {} + print(updated_template['data']) + if template_item in updated_template['data']: + data_dict = updated_template.pop('data') + else: + raise Exception("Item doesn't exist") - updated_template[template_item] = template_value + data_dict[template_item] = template_value + updated_template['data'] = data_dict stored_templates[template_name] = updated_template f.seek(0) json.dump(stored_templates, f) From 839c4e2441d7b8dd7fc3fc7d84b30a695a2cd6ed Mon Sep 17 00:00:00 2001 From: Sanjin Date: Thu, 2 Mar 2023 00:15:17 +0100 Subject: [PATCH 08/47] Fix: Added check for empty args --- httpie/cli/argtemplate.py | 1 - httpie/core.py | 33 +++++++++++++++++---------------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/httpie/cli/argtemplate.py b/httpie/cli/argtemplate.py index ef5199938c..308619a3e5 100644 --- a/httpie/cli/argtemplate.py +++ b/httpie/cli/argtemplate.py @@ -60,7 +60,6 @@ def edit_json_template(args): raise Exception("Template doesn't exist") data_dict = {} - print(updated_template['data']) if template_item in updated_template['data']: data_dict = updated_template.pop('data') else: diff --git a/httpie/core.py b/httpie/core.py index a72a5c779a..943c7c1c3a 100644 --- a/httpie/core.py +++ b/httpie/core.py @@ -49,22 +49,23 @@ def raw_main( if use_default_options and env.config.default_options: args = env.config.default_options + args - # http template || || - if (args[0] == "template"): - from httpie.cli.argtemplate import store_json_template - store_json_template(args[1:]) - return ExitStatus.SUCCESS - - # http runt - if (args[0] == "runt"): - from httpie.cli.argtemplate import store_json_template, load_template - args = load_template(args[1]) - - # http editt - if (args[0] == "editt"): - from httpie.cli.argtemplate import edit_json_template - edit_json_template(args[1:]) - return ExitStatus.SUCCESS + if args[0] is not None: + # http template || || + if (args[0] == "template"): + from httpie.cli.argtemplate import store_json_template + store_json_template(args[1:]) + return ExitStatus.SUCCESS + + # http runt + if (args[0] == "runt"): + from httpie.cli.argtemplate import store_json_template, load_template + args = load_template(args[1]) + + # http editt + if (args[0] == "editt"): + from httpie.cli.argtemplate import edit_json_template + edit_json_template(args[1:]) + return ExitStatus.SUCCESS include_debug_info = '--debug' in args include_traceback = include_debug_info or '--traceback' in args From 6a5b8058eacc21bb3765e6bc5476c8dacdad9eda Mon Sep 17 00:00:00 2001 From: editf Date: Thu, 2 Mar 2023 00:30:19 +0100 Subject: [PATCH 09/47] Add unit tests for store_json_template --- tests/test_argtemplate.py | 60 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 tests/test_argtemplate.py diff --git a/tests/test_argtemplate.py b/tests/test_argtemplate.py new file mode 100644 index 0000000000..32758f80e0 --- /dev/null +++ b/tests/test_argtemplate.py @@ -0,0 +1,60 @@ +""" Tests for creating and updating command templates """ +import httpie.cli.argtemplate +import tempfile +import json +from .utils import http + + +class TestStoreTemplate: + + def test_store_normal_template_with_method(self): + """ + Tests that a valid template can be stored properly when the template contains a method parameter + """ + + with tempfile.NamedTemporaryFile('w+', delete=False) as temp_fp: + + httpie.cli.argtemplate.TEMPLATE_FILE = temp_fp.name + + command = 'http template test_template GET https://catfact.ninja/fact param1=value1 param2=value2' + args = command.split() + + httpie.cli.argtemplate.store_json_template(args[2:]) + + stored_templates = json.load(temp_fp) + assert stored_templates[args[2]] is not None + + template = stored_templates[args[2]] + assert template['method'] == args[3] + assert template['url'] == args[4] + assert template['data'] is not None + + template_data = template['data'] + assert template_data['param1'] == 'value1' + assert template_data['param2'] == 'value2' + + def test_store_normal_template_without_method(self): + """ + Tests that a valid template can be stored properly when the template doesn't contain a method parameter + """ + + with tempfile.NamedTemporaryFile('w+', delete=False) as temp_fp: + + httpie.cli.argtemplate.TEMPLATE_FILE = temp_fp.name + + command = 'http template test_template https://catfact.ninja/fact param1=value1 param2=value2' + args = command.split() + + httpie.cli.argtemplate.store_json_template(args[2:]) + + stored_templates = json.load(temp_fp) + assert stored_templates[args[2]] is not None + + template = stored_templates[args[2]] + assert template['method'] == None + assert template['url'] == args[3] + assert template['data'] is not None + + template_data = template['data'] + assert template_data['param1'] == 'value1' + assert template_data['param2'] == 'value2' \ No newline at end of file From c74aabb9d5aed99935a5646f6b968224788bc102 Mon Sep 17 00:00:00 2001 From: editf Date: Thu, 2 Mar 2023 00:48:37 +0100 Subject: [PATCH 10/47] Add one unit test for editing a template This adds a unit test that checks that a value is correctly updated when modifying a certain parameter, and leaving the other values unchanged. --- tests/test_argtemplate.py | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/tests/test_argtemplate.py b/tests/test_argtemplate.py index 32758f80e0..c7af8b1dc6 100644 --- a/tests/test_argtemplate.py +++ b/tests/test_argtemplate.py @@ -57,4 +57,31 @@ def test_store_normal_template_without_method(self): template_data = template['data'] assert template_data['param1'] == 'value1' - assert template_data['param2'] == 'value2' \ No newline at end of file + assert template_data['param2'] == 'value2' + +class TestEditTemplate: + def test_edit_template_update_value(self): + """ + Tests that the edit_json_template function can correctly update a value + """ + with tempfile.NamedTemporaryFile('w+', delete=False) as temp_fp: + httpie.cli.argtemplate.TEMPLATE_FILE = temp_fp.name + + command = 'http template test_template GET https://catfact.ninja/fact param1=value1 param2=value2' + args = command.split() + + httpie.cli.argtemplate.store_json_template(args[2:]) + + httpie.cli.argtemplate.edit_json_template(['test_template', 'param1', 'newvalue1']) + + stored_templates = json.load(temp_fp) + assert stored_templates[args[2]] is not None + + template = stored_templates[args[2]] + assert template['method'] == 'GET' + assert template['url'] == args[4] + assert template['data'] is not None + + template_data = template['data'] + assert template_data['param1'] == 'newvalue1' + assert template_data['param2'] == 'value2' From a489dc2839870fc0e7a3634fd5197e0664faec2b Mon Sep 17 00:00:00 2001 From: Porsev Aslan Date: Mon, 6 Mar 2023 13:58:17 +0100 Subject: [PATCH 11/47] feat(editt): Add more functionality to editt #8 --- httpie/cli/argtemplate.py | 41 ++++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/httpie/cli/argtemplate.py b/httpie/cli/argtemplate.py index 308619a3e5..b63ec2196c 100644 --- a/httpie/cli/argtemplate.py +++ b/httpie/cli/argtemplate.py @@ -43,35 +43,40 @@ def store_json_template(args): def edit_json_template(args): stored_templates = {} - with open(TEMPLATE_FILE, "r+") as f: + with open("httpie/cli/templates.json", "r+") as f: try: stored_templates = json.load(f) except json.JSONDecodeError: pass + template_name = args.pop(0) template_item = args.pop(0) - template_value = args.pop(0) - updated_template = {} - - if template_name in stored_templates: - updated_template = stored_templates.pop(template_name) - - else: - raise Exception("Template doesn't exist") - - data_dict = {} - if template_item in updated_template['data']: - data_dict = updated_template.pop('data') + template_value = args.pop(0) + + # Check if the template exists + if template_name not in stored_templates: + print(f"Template '{template_name}' does not exist.") + return + + # Update the HTTP method + if template_item == 'method': + stored_templates[template_name]['method'] = template_value.upper() + # Update the URL + elif template_item == 'url': + stored_templates[template_name]['url'] = template_value + # Update a key-value pair in the data dictionary + elif template_item in stored_templates[template_name]['data']: + stored_templates[template_name]['data'][template_item] = template_value + # Add a new key-value pair to the data dictionary else: - raise Exception("Item doesn't exist") + stored_templates[template_name]['data'][template_item] = template_value - data_dict[template_item] = template_value - updated_template['data'] = data_dict - stored_templates[template_name] = updated_template + # Save the updated template to file f.seek(0) - json.dump(stored_templates, f) + json.dump(stored_templates, f) f.truncate() + def load_template(arg): with open(TEMPLATE_FILE, "r+") as f: stored_templates = {} From 6e68d6010081106bcd802f4e6648def8d5f0f6c1 Mon Sep 17 00:00:00 2001 From: Porsev Aslan Date: Mon, 6 Mar 2023 13:59:25 +0100 Subject: [PATCH 12/47] template(editt): Template changes after running new editt function #8 --- httpie/cli/templates.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/httpie/cli/templates.json b/httpie/cli/templates.json index 126af2428e..a1272a9c4f 100644 --- a/httpie/cli/templates.json +++ b/httpie/cli/templates.json @@ -1 +1 @@ -{"nytemplate": {"method": "POST", "url": "google.se", "data": {"name": "adam"}}, "nytemplate2": {"method": "POST", "url": "google.com", "data": {"name": "adam"}}} \ No newline at end of file +{"nytemplate2": {"method": "POST", "url": "google.com", "data": {"name": "adam"}}, "nytemplate": {"method": "GET", "url": "youtube.com", "data": {"name": "porsev"}}} \ No newline at end of file From 2e8288330b8853069995a3e8f400750abc05573a Mon Sep 17 00:00:00 2001 From: Porsev Aslan Date: Mon, 6 Mar 2023 14:06:26 +0100 Subject: [PATCH 13/47] fix(editt): Added the global variable as path #8 --- httpie/cli/argtemplate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/httpie/cli/argtemplate.py b/httpie/cli/argtemplate.py index b63ec2196c..0709aa4859 100644 --- a/httpie/cli/argtemplate.py +++ b/httpie/cli/argtemplate.py @@ -43,7 +43,7 @@ def store_json_template(args): def edit_json_template(args): stored_templates = {} - with open("httpie/cli/templates.json", "r+") as f: + with open(TEMPLATE_FILE, "r+") as f: try: stored_templates = json.load(f) except json.JSONDecodeError: From 40d1fb15d0a718ceb1e593555165e8fe0edba777 Mon Sep 17 00:00:00 2001 From: Porsev Aslan Date: Mon, 6 Mar 2023 14:10:47 +0100 Subject: [PATCH 14/47] =?UTF-8?q?fix(editt):=20Added=20=C2=B4Item=20does?= =?UTF-8?q?=20not=20exist=C2=B4=20message=20#8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- httpie/cli/argtemplate.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/httpie/cli/argtemplate.py b/httpie/cli/argtemplate.py index 0709aa4859..7c2a13b9e4 100644 --- a/httpie/cli/argtemplate.py +++ b/httpie/cli/argtemplate.py @@ -69,7 +69,8 @@ def edit_json_template(args): stored_templates[template_name]['data'][template_item] = template_value # Add a new key-value pair to the data dictionary else: - stored_templates[template_name]['data'][template_item] = template_value + print(f"Item '{template_item}' does not exist.") + return # Save the updated template to file f.seek(0) From 9b6cd92d84d91ae3ffe7b8cd373afad73e6d3ad0 Mon Sep 17 00:00:00 2001 From: editf Date: Mon, 6 Mar 2023 17:47:33 +0100 Subject: [PATCH 15/47] Add two more unit tests for store_template This includes one test for overwriting an already existing template, which passes, and one test for storing a template with an invalid method parameter, which currently fails (see #11). --- tests/test_argtemplate.py | 44 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/tests/test_argtemplate.py b/tests/test_argtemplate.py index c7af8b1dc6..eb8e08708f 100644 --- a/tests/test_argtemplate.py +++ b/tests/test_argtemplate.py @@ -59,6 +59,50 @@ def test_store_normal_template_without_method(self): assert template_data['param1'] == 'value1' assert template_data['param2'] == 'value2' + def test_store_template_overwrites_old_template_same_name(self): + """ + Tests that storing a template with the same name as an already existing template will overwrite the existing template + """ + with tempfile.NamedTemporaryFile('w+', delete=False) as temp_fp: + + httpie.cli.argtemplate.TEMPLATE_FILE = temp_fp.name + + command = 'http template test_template GET https://catfact.ninja/fact param1=value1 param2=value2' + args = command.split() + + httpie.cli.argtemplate.store_json_template(args[2:]) + + old_stored_templates = json.load(temp_fp) + + command = 'http template test_template POST https://catfact.ninja/fact param1=value2 param2=value1' + args = command.split() + httpie.cli.argtemplate.store_json_template(args[2:]) + + temp_fp.seek(0) + new_stored_templates = json.load(temp_fp) + + assert len(old_stored_templates) == len(new_stored_templates) + assert new_stored_templates[args[2]]['method'] == 'POST' + assert new_stored_templates[args[2]]['data']['param1'] == 'value2' + assert new_stored_templates[args[2]]['data']['param2'] == 'value1' + + def test_store_template_invalid_method(self): + """ + Tests that storing a template with an invalid method argument leads to the template being saved without a method parameter + """ + with tempfile.NamedTemporaryFile('w+', delete=False) as temp_fp: + httpie.cli.argtemplate.TEMPLATE_FILE = temp_fp.name + + command = 'http template test_template NOT_VALID_METHOD https://catfact.ninja/fact param1=value1 param2=value2' + args = command.split() + + httpie.cli.argtemplate.store_json_template(args[2:]) + + stored_templates = json.load(temp_fp) + print(stored_templates) + template = stored_templates[args[2]] + assert template['method'] is None + class TestEditTemplate: def test_edit_template_update_value(self): """ From 12e2186a9889f286e11a42bb47dc5fee8eb49d3a Mon Sep 17 00:00:00 2001 From: editf Date: Mon, 6 Mar 2023 17:51:28 +0100 Subject: [PATCH 16/47] Add unit tests for loading a template This adds two unit tests for loading a template which currently fail. See #10 and #12 for details. --- tests/test_argtemplate.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/tests/test_argtemplate.py b/tests/test_argtemplate.py index eb8e08708f..17065963c0 100644 --- a/tests/test_argtemplate.py +++ b/tests/test_argtemplate.py @@ -129,3 +129,34 @@ def test_edit_template_update_value(self): template_data = template['data'] assert template_data['param1'] == 'newvalue1' assert template_data['param2'] == 'value2' + +class TestLoadTemplate: + def test_load_template(self): + """ + Tests that loading a template yields the same arguments that were passed (except for 'http template ') + """ + with tempfile.NamedTemporaryFile('w+', delete=False) as temp_fp: + httpie.cli.argtemplate.TEMPLATE_FILE = temp_fp.name + + command = 'http template test_template GET https://catfact.ninja/fact param1=value1 param2=value2' + args = command.split() + + httpie.cli.argtemplate.store_json_template(args[2:]) + loaded_args = httpie.cli.argtemplate.load_template(args[2]) + + for i in range(len(args)-3): + assert args[i+3] == loaded_args[i] + + def test_load_template_not_found(self): + """ + Tests loading a template when the name of the template to load cannot be found in the template file + """ + with tempfile.NamedTemporaryFile('w+', delete=False) as temp_fp: + httpie.cli.argtemplate.TEMPLATE_FILE = temp_fp.name + + command = 'http template test_template GET https://catfact.ninja/fact param1=value1 param2=value2' + args = command.split() + + loaded_args = httpie.cli.argtemplate.load_template(args[2]) + assert loaded_args is None + \ No newline at end of file From c64cab4e6432ccbbf27cd8bae0f51a3c08098d93 Mon Sep 17 00:00:00 2001 From: editf Date: Mon, 6 Mar 2023 18:24:47 +0100 Subject: [PATCH 17/47] Update test_store_template_invalid_method This removes a debugging print statement and adds some assertions. --- tests/test_argtemplate.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/test_argtemplate.py b/tests/test_argtemplate.py index 17065963c0..ad67b810cd 100644 --- a/tests/test_argtemplate.py +++ b/tests/test_argtemplate.py @@ -99,9 +99,12 @@ def test_store_template_invalid_method(self): httpie.cli.argtemplate.store_json_template(args[2:]) stored_templates = json.load(temp_fp) - print(stored_templates) template = stored_templates[args[2]] + assert template is not None + assert template['url'] == args[4] assert template['method'] is None + assert template['data']['param1'] == 'value1' + assert template['data']['param2'] == 'value2' class TestEditTemplate: def test_edit_template_update_value(self): From 530caa0b08f82e1db60a1c090c017a2a566a4eeb Mon Sep 17 00:00:00 2001 From: editf Date: Mon, 6 Mar 2023 22:39:16 +0100 Subject: [PATCH 18/47] Add more unit tests for edit_template Most of them currently fail since the functionality hasn't been implemented/merged yet. Fixes #6 --- tests/test_argtemplate.py | 78 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 77 insertions(+), 1 deletion(-) diff --git a/tests/test_argtemplate.py b/tests/test_argtemplate.py index ad67b810cd..2bbf2f469a 100644 --- a/tests/test_argtemplate.py +++ b/tests/test_argtemplate.py @@ -3,7 +3,7 @@ import tempfile import json from .utils import http - +import pytest class TestStoreTemplate: @@ -132,6 +132,82 @@ def test_edit_template_update_value(self): template_data = template['data'] assert template_data['param1'] == 'newvalue1' assert template_data['param2'] == 'value2' + + def test_edit_template_add_method(self): + """ + Tests that you can edit a template and add a method when there previously was none + """ + with tempfile.NamedTemporaryFile('w+', delete=False) as temp_fp: + httpie.cli.argtemplate.TEMPLATE_FILE = temp_fp.name + + command = 'http template test_template https://catfact.ninja/fact param1=value1 param2=value2' + args = command.split() + + httpie.cli.argtemplate.store_json_template(args[2:]) + + httpie.cli.argtemplate.edit_json_template(['test_template', 'method', 'POST']) + + stored_templates = json.load(temp_fp) + assert len(stored_templates) == 1 + assert stored_templates[args[2]] is not None + + template = stored_templates[args[2]] + assert template['method'] == 'POST' + assert template['url'] == args[3] + assert template['data'] is not None + + def test_edit_template_change_url(self): + """ + Tests that you can change the URL of a template + """ + with tempfile.NamedTemporaryFile('w+', delete=False) as temp_fp: + httpie.cli.argtemplate.TEMPLATE_FILE = temp_fp.name + + command = 'http template test_template GET https://catfact.ninja/fact param1=value1 param2=value2' + args = command.split() + + httpie.cli.argtemplate.store_json_template(args[2:]) + + httpie.cli.argtemplate.edit_json_template(['test_template', 'url', 'https://fake-url/']) + + stored_templates = json.load(temp_fp) + assert len(stored_templates) == 1 + assert stored_templates[args[2]] is not None + + template = stored_templates[args[2]] + assert template['method'] == 'GET' + assert template['url'] == 'https://fake-url/' + assert template['data'] is not None + + def test_edit_template_not_found(self, capsys): + """ + Tests that an exception is raised when trying to edit a template that doesn't exist + """ + with tempfile.NamedTemporaryFile('w+', delete=False) as temp_fp: + httpie.cli.argtemplate.TEMPLATE_FILE = temp_fp.name + + with pytest.raises(Exception): + httpie.cli.argtemplate.edit_json_template(['test_template', 'param', 'value']) + out, _ = capsys.readouterr() + assert "Template 'test_template' does not exist." in out + + def test_edit_template_key_not_found(self): + """ + Tests that you can add new key-value pairs to an existing template + """ + with tempfile.NamedTemporaryFile('w+', delete=False) as temp_fp: + httpie.cli.argtemplate.TEMPLATE_FILE = temp_fp.name + + command = 'http template test_template GET https://catfact.ninja/fact param1=value1 param2=value2' + args = command.split() + + httpie.cli.argtemplate.store_json_template(args[2:]) + old_stored_templates = json.load(temp_fp) + assert old_stored_templates[args[2]]['data']['param2'] is None + + httpie.cli.argtemplate.edit_json_template(['test_template', 'param2', 'value2']) + new_stored_template = json.load(temp_fp) + assert new_stored_templates[args[2]]['data']['param2'] == 'value2' class TestLoadTemplate: def test_load_template(self): From 8d11b5174fb15efb4f9da3c328a19aeb1399effc Mon Sep 17 00:00:00 2001 From: Porsev Aslan Date: Tue, 7 Mar 2023 12:26:52 +0100 Subject: [PATCH 19/47] fix(editt): Fix after receiving feedback #8 --- httpie/cli/argtemplate.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/httpie/cli/argtemplate.py b/httpie/cli/argtemplate.py index 7c2a13b9e4..0709aa4859 100644 --- a/httpie/cli/argtemplate.py +++ b/httpie/cli/argtemplate.py @@ -69,8 +69,7 @@ def edit_json_template(args): stored_templates[template_name]['data'][template_item] = template_value # Add a new key-value pair to the data dictionary else: - print(f"Item '{template_item}' does not exist.") - return + stored_templates[template_name]['data'][template_item] = template_value # Save the updated template to file f.seek(0) From 9528df4ff245d0d1daf8a2f0d26d7111b9281de1 Mon Sep 17 00:00:00 2001 From: Porsev Aslan Date: Tue, 7 Mar 2023 12:51:21 +0100 Subject: [PATCH 20/47] bug(editt): Fix formatting in argtemplate #14 --- httpie/cli/argtemplate.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/httpie/cli/argtemplate.py b/httpie/cli/argtemplate.py index 0709aa4859..c77e520a47 100644 --- a/httpie/cli/argtemplate.py +++ b/httpie/cli/argtemplate.py @@ -1,9 +1,9 @@ -import argparse import json -import sys + TEMPLATE_FILE = "httpie/cli/templates.json" + def store_json_template(args): """ Store a template as a string in templates.json, the format for running this is: @@ -13,13 +13,13 @@ def store_json_template(args): template_method = None template_url = None template_variables = {} - + if ["CONNECT", "DELETE", "GET", "HEAD", "OPTIONS", "POST", "PUT", "TRACE", "PATCH"].__contains__(args[0]): template_method = args.pop(0) template_url = args.pop(0) else: template_url = args.pop(0) - + for arg in args: variable_name, variable_value = arg.split("=") template_variables[variable_name] = variable_value @@ -41,6 +41,7 @@ def store_json_template(args): json.dump(stored_templates, f) f.truncate() + def edit_json_template(args): stored_templates = {} with open(TEMPLATE_FILE, "r+") as f: @@ -86,7 +87,7 @@ def load_template(arg): pass args = [] args_dict = stored_templates[arg] - if not args_dict is None: + if args_dict is not None: args.append(args_dict.pop('method')) args.append(args_dict.pop('url')) data_dict = args_dict.pop('data') From e3b06c295c7bac4381c60d842d8eb5b4788eda95 Mon Sep 17 00:00:00 2001 From: Porsev Aslan Date: Tue, 7 Mar 2023 12:51:40 +0100 Subject: [PATCH 21/47] bug(editt): Fix formatting in core #14 --- httpie/core.py | 1 - 1 file changed, 1 deletion(-) diff --git a/httpie/core.py b/httpie/core.py index 943c7c1c3a..a6b0da0c50 100644 --- a/httpie/core.py +++ b/httpie/core.py @@ -1,5 +1,4 @@ import argparse -import json import os import platform import sys From 56851442754dffc9f74c96592d7255988710cbea Mon Sep 17 00:00:00 2001 From: Porsev Aslan Date: Tue, 7 Mar 2023 12:52:01 +0100 Subject: [PATCH 22/47] bug(editt): Fix formatting in test #14 --- tests/test_argtemplate.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_argtemplate.py b/tests/test_argtemplate.py index c7af8b1dc6..becec2a3f5 100644 --- a/tests/test_argtemplate.py +++ b/tests/test_argtemplate.py @@ -2,7 +2,6 @@ import httpie.cli.argtemplate import tempfile import json -from .utils import http class TestStoreTemplate: @@ -51,7 +50,7 @@ def test_store_normal_template_without_method(self): assert stored_templates[args[2]] is not None template = stored_templates[args[2]] - assert template['method'] == None + assert template['method'] is None assert template['url'] == args[3] assert template['data'] is not None @@ -59,6 +58,7 @@ def test_store_normal_template_without_method(self): assert template_data['param1'] == 'value1' assert template_data['param2'] == 'value2' + class TestEditTemplate: def test_edit_template_update_value(self): """ From a9df3f25a9841b88031ab4d9d87c2ffd6c289875 Mon Sep 17 00:00:00 2001 From: Porsev Aslan Date: Tue, 7 Mar 2023 13:28:52 +0100 Subject: [PATCH 23/47] bug(template): Fix invalid argument error #11 --- httpie/cli/argtemplate.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/httpie/cli/argtemplate.py b/httpie/cli/argtemplate.py index c77e520a47..f6637f7535 100644 --- a/httpie/cli/argtemplate.py +++ b/httpie/cli/argtemplate.py @@ -18,11 +18,16 @@ def store_json_template(args): template_method = args.pop(0) template_url = args.pop(0) else: + temp = args.pop(0) + print(f"'{temp}' is not a valid http method, defaulting to null...") template_url = args.pop(0) for arg in args: - variable_name, variable_value = arg.split("=") - template_variables[variable_name] = variable_value + if '=' in arg: + variable_name, variable_value = arg.split("=") + template_variables[variable_name] = variable_value + else: + template_variables[arg] = True template = {} template['method'] = template_method From d9d897ec58abc3d4c921e7460d354ccbaecf6a87 Mon Sep 17 00:00:00 2001 From: Porsev Aslan Date: Tue, 7 Mar 2023 14:13:00 +0100 Subject: [PATCH 24/47] bug(test): Fix formatting for tests #18 --- tests/test_argtemplate.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/tests/test_argtemplate.py b/tests/test_argtemplate.py index e5f5472f95..012df490c1 100644 --- a/tests/test_argtemplate.py +++ b/tests/test_argtemplate.py @@ -2,9 +2,9 @@ import httpie.cli.argtemplate import tempfile import json -from .utils import http import pytest + class TestStoreTemplate: def test_store_normal_template_with_method(self): @@ -106,6 +106,7 @@ def test_store_template_invalid_method(self): assert template['data']['param1'] == 'value1' assert template['data']['param2'] == 'value2' + class TestEditTemplate: def test_edit_template_update_value(self): """ @@ -132,7 +133,7 @@ def test_edit_template_update_value(self): template_data = template['data'] assert template_data['param1'] == 'newvalue1' assert template_data['param2'] == 'value2' - + def test_edit_template_add_method(self): """ Tests that you can edit a template and add a method when there previously was none @@ -178,7 +179,7 @@ def test_edit_template_change_url(self): assert template['method'] == 'GET' assert template['url'] == 'https://fake-url/' assert template['data'] is not None - + def test_edit_template_not_found(self, capsys): """ Tests that an exception is raised when trying to edit a template that doesn't exist @@ -206,9 +207,10 @@ def test_edit_template_key_not_found(self): assert old_stored_templates[args[2]]['data']['param2'] is None httpie.cli.argtemplate.edit_json_template(['test_template', 'param2', 'value2']) - new_stored_template = json.load(temp_fp) + new_stored_templates = json.load(temp_fp) assert new_stored_templates[args[2]]['data']['param2'] == 'value2' + class TestLoadTemplate: def test_load_template(self): """ @@ -223,8 +225,8 @@ def test_load_template(self): httpie.cli.argtemplate.store_json_template(args[2:]) loaded_args = httpie.cli.argtemplate.load_template(args[2]) - for i in range(len(args)-3): - assert args[i+3] == loaded_args[i] + for i in range(len(args) - 3): + assert args[i + 3] == loaded_args[i] def test_load_template_not_found(self): """ @@ -238,4 +240,3 @@ def test_load_template_not_found(self): loaded_args = httpie.cli.argtemplate.load_template(args[2]) assert loaded_args is None - \ No newline at end of file From e2d836b994285df701c8dd2e7f4bc6641d2c9ddc Mon Sep 17 00:00:00 2001 From: Porsev Aslan Date: Tue, 7 Mar 2023 14:36:16 +0100 Subject: [PATCH 25/47] bug(template): Fix error if no templates file exists #20 --- httpie/cli/argtemplate.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/httpie/cli/argtemplate.py b/httpie/cli/argtemplate.py index f6637f7535..8d6ce87c44 100644 --- a/httpie/cli/argtemplate.py +++ b/httpie/cli/argtemplate.py @@ -1,4 +1,5 @@ import json +import os TEMPLATE_FILE = "httpie/cli/templates.json" @@ -33,6 +34,11 @@ def store_json_template(args): template['method'] = template_method template['url'] = template_url template['data'] = template_variables + + # Check if the templates.json file exists + if not os.path.isfile(TEMPLATE_FILE): + open(TEMPLATE_FILE, "w").close() + with open(TEMPLATE_FILE, "r+") as f: stored_templates = {} try: @@ -49,6 +55,11 @@ def store_json_template(args): def edit_json_template(args): stored_templates = {} + + # Check if the templates.json file exists + if not os.path.isfile(TEMPLATE_FILE): + open(TEMPLATE_FILE, "w").close() + with open(TEMPLATE_FILE, "r+") as f: try: stored_templates = json.load(f) @@ -84,6 +95,10 @@ def edit_json_template(args): def load_template(arg): + # Check if the templates.json file exists + if not os.path.isfile(TEMPLATE_FILE): + open(TEMPLATE_FILE, "w").close() + with open(TEMPLATE_FILE, "r+") as f: stored_templates = {} try: From 02e4ab0bb5ee2c7bd66ec371944a8fadb43e71ad Mon Sep 17 00:00:00 2001 From: Sanjin Date: Tue, 7 Mar 2023 17:30:14 +0100 Subject: [PATCH 26/47] Fix: Issue/26 --- httpie/cli/argtemplate.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/httpie/cli/argtemplate.py b/httpie/cli/argtemplate.py index 8d6ce87c44..24b9ddef83 100644 --- a/httpie/cli/argtemplate.py +++ b/httpie/cli/argtemplate.py @@ -19,9 +19,8 @@ def store_json_template(args): template_method = args.pop(0) template_url = args.pop(0) else: - temp = args.pop(0) - print(f"'{temp}' is not a valid http method, defaulting to null...") template_url = args.pop(0) + print(f"'{template_url}' is not a valid http method, defaulting to null...") for arg in args: if '=' in arg: From f9cf2565b824b116eeb49d7a7ea13a1e795766a3 Mon Sep 17 00:00:00 2001 From: Sanjin Date: Tue, 7 Mar 2023 17:52:29 +0100 Subject: [PATCH 27/47] Revert: undo issue/26 --- httpie/cli/argtemplate.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/httpie/cli/argtemplate.py b/httpie/cli/argtemplate.py index 24b9ddef83..8d6ce87c44 100644 --- a/httpie/cli/argtemplate.py +++ b/httpie/cli/argtemplate.py @@ -19,8 +19,9 @@ def store_json_template(args): template_method = args.pop(0) template_url = args.pop(0) else: + temp = args.pop(0) + print(f"'{temp}' is not a valid http method, defaulting to null...") template_url = args.pop(0) - print(f"'{template_url}' is not a valid http method, defaulting to null...") for arg in args: if '=' in arg: From 1c560baf56fc12f97fe091ac9576e9271a830b23 Mon Sep 17 00:00:00 2001 From: Sanjin Date: Tue, 7 Mar 2023 18:06:34 +0100 Subject: [PATCH 28/47] Fix: Method names can be lower case now --- httpie/cli/argtemplate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/httpie/cli/argtemplate.py b/httpie/cli/argtemplate.py index 8d6ce87c44..5e946aaad5 100644 --- a/httpie/cli/argtemplate.py +++ b/httpie/cli/argtemplate.py @@ -15,7 +15,7 @@ def store_json_template(args): template_url = None template_variables = {} - if ["CONNECT", "DELETE", "GET", "HEAD", "OPTIONS", "POST", "PUT", "TRACE", "PATCH"].__contains__(args[0]): + if ["CONNECT", "DELETE", "GET", "HEAD", "OPTIONS", "POST", "PUT", "TRACE", "PATCH"].__contains__(args[0].upper()): template_method = args.pop(0) template_url = args.pop(0) else: From 6a8669128f268da44f0930e51d829643b5103932 Mon Sep 17 00:00:00 2001 From: Sanjin Date: Tue, 7 Mar 2023 18:12:19 +0100 Subject: [PATCH 29/47] Ft: Input validation --- httpie/core.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/httpie/core.py b/httpie/core.py index a6b0da0c50..026610524d 100644 --- a/httpie/core.py +++ b/httpie/core.py @@ -49,19 +49,38 @@ def raw_main( args = env.config.default_options + args if args[0] is not None: - # http template || || + # Unlike when running httpie commands without templates, when creating templates you need to specify an http method + # http template || if (args[0] == "template"): + if len(args) < 2: + print("No template name was specified") + return ExitStatus.ERROR + if len(args) < 4: + print("Template needs at least a METHOD and a URL") + return ExitStatus.ERROR from httpie.cli.argtemplate import store_json_template store_json_template(args[1:]) return ExitStatus.SUCCESS # http runt if (args[0] == "runt"): + if len(args) < 2: + print("No template name was specified") + return ExitStatus.ERROR + if len(args) > 2: + print("Too many arguments, http