{ "info": { "author": "Tetsuya Morimoto", "author_email": "tetsuya.morimoto@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "Operating System :: MacOS :: MacOS X", "Operating System :: Microsoft :: Windows", "Operating System :: POSIX", "Programming Language :: Python", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Topic :: Software Development :: Libraries", "Topic :: Software Development :: Quality Assurance", "Topic :: Software Development :: Testing", "Topic :: Utilities" ], "description": ".. image:: https://drone.io/bitbucket.org/pytest-dev/pytest-curl-report/status.png\n :target: https://drone.io/bitbucket.org/pytest-dev/pytest-curl-report/latest\n\nRequirements\n------------\n\n* Python 2.6 or 3.3 and later\n\n\nFeatures\n--------\n\n* Provide additional `cURL`_ report if a testcase includes http request would fail\n* Support urllib/urllib2 and `requests`_ as a http request object\n* Support cURL command line below options\n\n * method\n * proxy\n * header\n * form data\n * attachment file\n\n.. _cURL: http://curl.haxx.se/\n.. _requests: http://docs.python-requests.org/\n\n\nInstallation\n============\n\n::\n\n $ pip install pytest-curl-report\n\n\nQuick Start\n===========\n\nCreate a test file requesting a web server via http[s] and intend to fail\nthe test.\n\n::\n\n $ vi test.py\n # -*- coding: utf-8 -*-\n import requests\n\n def test_requests_get():\n r = requests.get('http://httpbin.org/get')\n assert False\n\nThen, pytest shows the report as below.\n\n::\n\n $ py.test test.py\n ============================= test session starts ==============================\n platform darwin -- Python 2.7.9 -- py-1.4.27 -- pytest-2.6.4\n plugins: curl-report, httpbin, cache, capturelog, cov, flakes, pep8\n collected 1 items\n\n test.py F\n\n =================================== FAILURES ===================================\n ______________________________ test_requests_get _______________________________\n\n def test_requests_get():\n r = requests.get('http://httpbin.org/get')\n > assert False\n E assert False\n\n test.py:7: AssertionError\n -------------------------- How to reproduce with curl --------------------------\n curl -X GET -H \"Connection: keep-alive\" -H \"Accept-Encoding: gzip, deflate\"\n -H \"Accept: */*\" -H \"User-Agent: python-requests/2.7.0 CPython/2.7.9 Darwin/14.3.0\"\n \"http://httpbin.org/get\"\n\nThe pytest-curl-report plugin generates cURL command line to reproduce http\nrequest to the web server. Copy the cURL command and paste it on terminal,\nthen you can run the command immediately. It might be useful to tell the\ndevelopers how to reproduce an issue when the test was failed.\n\nThe cURL report would be generated from *Request* object in test code,\nso you don't have to configure some settings or use particular snippet.\n\n\nUsage\n=====\n\nThere are several options.\n\n::\n\n $ py.test -h\n ...\n curl report:\n --no-curl-report not generate curl report when a testcase is failed\n --curl-report-only strip pytest assertion log and generate curl report\n only\n ...\n\n*--curl-report-only* is useful if you want to confirm cURL commands only.\nFor example, you prefer test first concept and use the cli for interactive\ndevelopment.\n\n::\n\n $ vi test.py\n ...\n def test_requests_post():\n r = requests.post('https://httpbin.org/post', data={\"test\": \"example\"})\n assert False\n\n $ py.test --curl-report-only test.py\n =================================== FAILURES ===================================\n ______________________________ test_requests_get _______________________________\n -------------------------- How to reproduce with curl --------------------------\n curl -X GET -H \"Connection: keep-alive\" -H \"Accept-Encoding: gzip, deflate\"\n -H \"Accept: */*\" -H \"User-Agent: python-requests/2.7.0 CPython/2.7.9 Darwin/14.3.0\"\n \"http://httpbin.org/get\"\n ______________________________ test_requests_post ______________________________\n -------------------------- How to reproduce with curl --------------------------\n curl -X POST -H \"Content-Length: 12\" -H \"Accept-Encoding: gzip, deflate\"\n -H \"Accept: */*\" -H \"User-Agent: python-requests/2.7.0 CPython/2.7.9 Darwin/14.3.0\"\n -H \"Connection: keep-alive\" -H \"Content-Type: application/x-www-form-urlencoded\"\n -d \"test=example\" \"https://httpbin.org/post\"\n =========================== 2 failed in 1.33 seconds ===========================\n\nAs described above, you might think that some headers are redundant.\nAdd some code into conftest.py, then restrict headers you need.\n\n::\n\n $ vi conftest.py\n def pytest_namespace():\n return {'curl_report': {'headers': ['Content-Type']}}\n\n $ py.test test.py\n ...\n ______________________________ test_requests_post ______________________________\n -------------------------- How to reproduce with curl --------------------------\n curl -X POST -H \"Content-Type: application/x-www-form-urlencoded\"\n -d \"test=example\" \"https://httpbin.org/post\"\n\nIn this case, only *Content-Type* header is generated.\n\nProxy Settings\n--------------\n\nUnfortunately, it seems *Request* object doesn't keep proxy settings.\nProxy settings are retrieved from environment variable on platform.\nSo add environment variable to detect the settings by plugin,\neven if you give the settings with another way.\n\n::\n\n $ vi test.py\n def test_requests_proxy_post():\n import os\n os.environ['HTTPS_PROXY'] = 'https://127.0.0.1:8888'\n r = requests.post('https://httpbin.org/post', data={\"test\": \"example\"})\n assert False\n\n $ py.test test.py\n ...\n -------------------------- How to reproduce with curl --------------------------\n curl -X POST -x https://127.0.0.1:8888\n -H \"Content-Type: application/x-www-form-urlencoded\" -d \"test=example\"\n \"https://httpbin.org/post\"\n\n\nChangeLog\n=========\n\n0.5.4 (2016-12-11)\n------------------\n* fix some failed tests\n\n0.5.3 (2016-12-04)\n------------------\n\n* fix a bug when multipart/form-data is binary\n\n0.5.2 (2015-05-19)\n------------------\n\n* fix a trivial typo\n\n0.5.1 (2015-05-19)\n------------------\n\n* fix an issue when --curl-report-only is given\n\n0.5.0 (2015-05-17)\n------------------\n* first release", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://bitbucket.org/pytest-dev/pytest-curl-report", "keywords": "test,pytest,curl", "license": "Apache License 2.0", "maintainer": "", "maintainer_email": "", "name": "pytest-curl-report", "package_url": "https://pypi.org/project/pytest-curl-report/", "platform": "linux,osx,unix,win32", "project_url": "https://pypi.org/project/pytest-curl-report/", "project_urls": { "Homepage": "https://bitbucket.org/pytest-dev/pytest-curl-report" }, "release_url": "https://pypi.org/project/pytest-curl-report/0.5.4/", "requires_dist": null, "requires_python": "", "summary": "pytest plugin to generate curl command line report", "version": "0.5.4" }, "last_serial": 2511470, "releases": { "0.5.0": [ { "comment_text": "", "digests": { "md5": "cc951308929aaeccb71b76d07a6bcbcb", "sha256": "1a112bb18efa4b506b57dda2b04133263d34795a53bd9c6f6623f26dbf1f869e" }, "downloads": -1, "filename": "pytest-curl-report-0.5.0.tar.gz", "has_sig": false, "md5_digest": "cc951308929aaeccb71b76d07a6bcbcb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13400, "upload_time": "2015-05-16T21:46:28", "url": "https://files.pythonhosted.org/packages/d6/e2/3f326e321480ff346ce59a7bdb9884519d5d6364f58ccee829f31db1e992/pytest-curl-report-0.5.0.tar.gz" } ], "0.5.1": [ { "comment_text": "", "digests": { "md5": "e78051ef187fa8e08ac1ab7c51d59032", "sha256": "b3da6bcf4131bc6a4a5cf49d75619137b60e35691e3733d793bce8f1456882ac" }, "downloads": -1, "filename": "pytest-curl-report-0.5.1.tar.gz", "has_sig": false, "md5_digest": "e78051ef187fa8e08ac1ab7c51d59032", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13851, "upload_time": "2015-05-19T09:28:15", "url": "https://files.pythonhosted.org/packages/22/a3/4b02886729e1c811a60273caaff5fc5202e9c5e01810c61a59c3a10a8635/pytest-curl-report-0.5.1.tar.gz" } ], "0.5.2": [ { "comment_text": "", "digests": { "md5": "788e87dbe1ec6804d3e309978818214c", "sha256": "a99b6cd359ca4226acb959cb45ef3427c8d80d1687fdfa12d6f298f470be7f0e" }, "downloads": -1, "filename": "pytest-curl-report-0.5.2.tar.gz", "has_sig": false, "md5_digest": "788e87dbe1ec6804d3e309978818214c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13883, "upload_time": "2015-05-19T09:33:49", "url": "https://files.pythonhosted.org/packages/64/bc/79faea56ab204ff1dbd44cef54d4ed992a9f03731fe94e198ff71ea79a1b/pytest-curl-report-0.5.2.tar.gz" } ], "0.5.3": [ { "comment_text": "", "digests": { "md5": "4f0559a18bbab7c11f11623d4869a05f", "sha256": "6d76d50067e0acb5df0da113ec9dc5d698b876bc5f6e0edd3a78bd41c53e03ce" }, "downloads": -1, "filename": "pytest-curl-report-0.5.3.tar.gz", "has_sig": false, "md5_digest": "4f0559a18bbab7c11f11623d4869a05f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13880, "upload_time": "2016-12-04T13:40:17", "url": "https://files.pythonhosted.org/packages/33/20/dfd539e66ac3c67dc9e449475158d65a28345293baff12566ceab18f64f1/pytest-curl-report-0.5.3.tar.gz" } ], "0.5.4": [ { "comment_text": "", "digests": { "md5": "a27abb4ade1bf4598e52ff7f35f6c6cc", "sha256": "ecedaaef39d141a8c2dc5f734a461fce1f751d59570b5c88e392576487201fbe" }, "downloads": -1, "filename": "pytest-curl-report-0.5.4.tar.gz", "has_sig": false, "md5_digest": "a27abb4ade1bf4598e52ff7f35f6c6cc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13878, "upload_time": "2016-12-11T04:32:30", "url": "https://files.pythonhosted.org/packages/4c/e5/6aa391bda0ecbc6d63039edb41dcf50428060d337a792628cfef1dc75c54/pytest-curl-report-0.5.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "a27abb4ade1bf4598e52ff7f35f6c6cc", "sha256": "ecedaaef39d141a8c2dc5f734a461fce1f751d59570b5c88e392576487201fbe" }, "downloads": -1, "filename": "pytest-curl-report-0.5.4.tar.gz", "has_sig": false, "md5_digest": "a27abb4ade1bf4598e52ff7f35f6c6cc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13878, "upload_time": "2016-12-11T04:32:30", "url": "https://files.pythonhosted.org/packages/4c/e5/6aa391bda0ecbc6d63039edb41dcf50428060d337a792628cfef1dc75c54/pytest-curl-report-0.5.4.tar.gz" } ] }