mirror of
https://github.com/CCOSTAN/Home-AssistantConfig.git
synced 2025-11-06 17:51:36 +00:00
Initial Configuration Push
This commit is contained in:
169
deps/responses-0.5.1.dist-info/DESCRIPTION.rst
vendored
Normal file
169
deps/responses-0.5.1.dist-info/DESCRIPTION.rst
vendored
Normal file
@@ -0,0 +1,169 @@
|
||||
Responses
|
||||
=========
|
||||
|
||||
.. image:: https://travis-ci.org/getsentry/responses.png?branch=master
|
||||
:target: https://travis-ci.org/getsentry/responses
|
||||
|
||||
A utility library for mocking out the `requests` Python library.
|
||||
|
||||
.. note:: Responses requires Requests >= 2.0
|
||||
|
||||
Response body as string
|
||||
-----------------------
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
import responses
|
||||
import requests
|
||||
|
||||
@responses.activate
|
||||
def test_my_api():
|
||||
responses.add(responses.GET, 'http://twitter.com/api/1/foobar',
|
||||
body='{"error": "not found"}', status=404,
|
||||
content_type='application/json')
|
||||
|
||||
resp = requests.get('http://twitter.com/api/1/foobar')
|
||||
|
||||
assert resp.json() == {"error": "not found"}
|
||||
|
||||
assert len(responses.calls) == 1
|
||||
assert responses.calls[0].request.url == 'http://twitter.com/api/1/foobar'
|
||||
assert responses.calls[0].response.text == '{"error": "not found"}'
|
||||
|
||||
You can also specify a JSON object instead of a body string.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
import responses
|
||||
import requests
|
||||
|
||||
@responses.activate
|
||||
def test_my_api():
|
||||
responses.add(responses.GET, 'http://twitter.com/api/1/foobar',
|
||||
json={"error": "not found"}, status=404)
|
||||
|
||||
resp = requests.get('http://twitter.com/api/1/foobar')
|
||||
|
||||
assert resp.json() == {"error": "not found"}
|
||||
|
||||
assert len(responses.calls) == 1
|
||||
assert responses.calls[0].request.url == 'http://twitter.com/api/1/foobar'
|
||||
assert responses.calls[0].response.text == '{"error": "not found"}'
|
||||
|
||||
Request callback
|
||||
----------------
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
import json
|
||||
|
||||
import responses
|
||||
import requests
|
||||
|
||||
@responses.activate
|
||||
def test_calc_api():
|
||||
|
||||
def request_callback(request):
|
||||
payload = json.loads(request.body)
|
||||
resp_body = {'value': sum(payload['numbers'])}
|
||||
headers = {'request-id': '728d329e-0e86-11e4-a748-0c84dc037c13'}
|
||||
return (200, headers, json.dumps(resp_body))
|
||||
|
||||
responses.add_callback(
|
||||
responses.POST, 'http://calc.com/sum',
|
||||
callback=request_callback,
|
||||
content_type='application/json',
|
||||
)
|
||||
|
||||
resp = requests.post(
|
||||
'http://calc.com/sum',
|
||||
json.dumps({'numbers': [1, 2, 3]}),
|
||||
headers={'content-type': 'application/json'},
|
||||
)
|
||||
|
||||
assert resp.json() == {'value': 6}
|
||||
|
||||
assert len(responses.calls) == 1
|
||||
assert responses.calls[0].request.url == 'http://calc.com/sum'
|
||||
assert responses.calls[0].response.text == '{"value": 6}'
|
||||
assert (
|
||||
responses.calls[0].response.headers['request-id'] ==
|
||||
'728d329e-0e86-11e4-a748-0c84dc037c13'
|
||||
)
|
||||
|
||||
Instead of passing a string URL into `responses.add` or `responses.add_callback`
|
||||
you can also supply a compiled regular expression.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
import re
|
||||
import responses
|
||||
import requests
|
||||
|
||||
# Instead of
|
||||
responses.add(responses.GET, 'http://twitter.com/api/1/foobar',
|
||||
body='{"error": "not found"}', status=404,
|
||||
content_type='application/json')
|
||||
|
||||
# You can do the following
|
||||
url_re = re.compile(r'https?://twitter.com/api/\d+/foobar')
|
||||
responses.add(responses.GET, url_re,
|
||||
body='{"error": "not found"}', status=404,
|
||||
content_type='application/json')
|
||||
|
||||
A response can also throw an exception as follows.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
import responses
|
||||
import requests
|
||||
from requests.exceptions import HTTPError
|
||||
|
||||
exception = HTTPError('Something went wrong')
|
||||
responses.add(responses.GET, 'http://twitter.com/api/1/foobar',
|
||||
body=exception)
|
||||
# All calls to 'http://twitter.com/api/1/foobar' will throw exception.
|
||||
|
||||
|
||||
Responses as a context manager
|
||||
------------------------------
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
import responses
|
||||
import requests
|
||||
|
||||
|
||||
def test_my_api():
|
||||
with responses.RequestsMock() as rsps:
|
||||
rsps.add(responses.GET, 'http://twitter.com/api/1/foobar',
|
||||
body='{}', status=200,
|
||||
content_type='application/json')
|
||||
resp = requests.get('http://twitter.com/api/1/foobar')
|
||||
|
||||
assert resp.status_code == 200
|
||||
|
||||
# outside the context manager requests will hit the remote server
|
||||
resp = requests.get('http://twitter.com/api/1/foobar')
|
||||
resp.status_code == 404
|
||||
|
||||
|
||||
Assertions on declared responses
|
||||
--------------------------------
|
||||
|
||||
By default Responses will raise an assertion error if a url was registered but not accessed. This
|
||||
can be disabled by passing the ``assert_all_requests_are_fired`` value:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
import responses
|
||||
import requests
|
||||
|
||||
|
||||
def test_my_api():
|
||||
with responses.RequestsMock(assert_all_requests_are_fired=False) as rsps:
|
||||
rsps.add(responses.GET, 'http://twitter.com/api/1/foobar',
|
||||
body='{}', status=200,
|
||||
content_type='application/json')
|
||||
|
||||
|
||||
1
deps/responses-0.5.1.dist-info/INSTALLER
vendored
Normal file
1
deps/responses-0.5.1.dist-info/INSTALLER
vendored
Normal file
@@ -0,0 +1 @@
|
||||
pip
|
||||
194
deps/responses-0.5.1.dist-info/METADATA
vendored
Normal file
194
deps/responses-0.5.1.dist-info/METADATA
vendored
Normal file
@@ -0,0 +1,194 @@
|
||||
Metadata-Version: 2.0
|
||||
Name: responses
|
||||
Version: 0.5.1
|
||||
Summary: A utility library for mocking out the `requests` Python library.
|
||||
Home-page: https://github.com/getsentry/responses
|
||||
Author: David Cramer
|
||||
Author-email: UNKNOWN
|
||||
License: Apache 2.0
|
||||
Platform: UNKNOWN
|
||||
Classifier: Intended Audience :: Developers
|
||||
Classifier: Intended Audience :: System Administrators
|
||||
Classifier: Operating System :: OS Independent
|
||||
Classifier: Programming Language :: Python :: 2
|
||||
Classifier: Programming Language :: Python :: 3
|
||||
Classifier: Topic :: Software Development
|
||||
Requires-Dist: cookies
|
||||
Requires-Dist: requests (>=2.0)
|
||||
Requires-Dist: six
|
||||
Requires-Dist: mock; python_version in "2.6, 2.7, 3.2"
|
||||
Provides-Extra: tests
|
||||
Requires-Dist: coverage (>=3.7.1,<5.0.0); extra == 'tests'
|
||||
Requires-Dist: flake8; extra == 'tests'
|
||||
Requires-Dist: pytest; extra == 'tests'
|
||||
Requires-Dist: pytest-cov; extra == 'tests'
|
||||
|
||||
Responses
|
||||
=========
|
||||
|
||||
.. image:: https://travis-ci.org/getsentry/responses.png?branch=master
|
||||
:target: https://travis-ci.org/getsentry/responses
|
||||
|
||||
A utility library for mocking out the `requests` Python library.
|
||||
|
||||
.. note:: Responses requires Requests >= 2.0
|
||||
|
||||
Response body as string
|
||||
-----------------------
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
import responses
|
||||
import requests
|
||||
|
||||
@responses.activate
|
||||
def test_my_api():
|
||||
responses.add(responses.GET, 'http://twitter.com/api/1/foobar',
|
||||
body='{"error": "not found"}', status=404,
|
||||
content_type='application/json')
|
||||
|
||||
resp = requests.get('http://twitter.com/api/1/foobar')
|
||||
|
||||
assert resp.json() == {"error": "not found"}
|
||||
|
||||
assert len(responses.calls) == 1
|
||||
assert responses.calls[0].request.url == 'http://twitter.com/api/1/foobar'
|
||||
assert responses.calls[0].response.text == '{"error": "not found"}'
|
||||
|
||||
You can also specify a JSON object instead of a body string.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
import responses
|
||||
import requests
|
||||
|
||||
@responses.activate
|
||||
def test_my_api():
|
||||
responses.add(responses.GET, 'http://twitter.com/api/1/foobar',
|
||||
json={"error": "not found"}, status=404)
|
||||
|
||||
resp = requests.get('http://twitter.com/api/1/foobar')
|
||||
|
||||
assert resp.json() == {"error": "not found"}
|
||||
|
||||
assert len(responses.calls) == 1
|
||||
assert responses.calls[0].request.url == 'http://twitter.com/api/1/foobar'
|
||||
assert responses.calls[0].response.text == '{"error": "not found"}'
|
||||
|
||||
Request callback
|
||||
----------------
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
import json
|
||||
|
||||
import responses
|
||||
import requests
|
||||
|
||||
@responses.activate
|
||||
def test_calc_api():
|
||||
|
||||
def request_callback(request):
|
||||
payload = json.loads(request.body)
|
||||
resp_body = {'value': sum(payload['numbers'])}
|
||||
headers = {'request-id': '728d329e-0e86-11e4-a748-0c84dc037c13'}
|
||||
return (200, headers, json.dumps(resp_body))
|
||||
|
||||
responses.add_callback(
|
||||
responses.POST, 'http://calc.com/sum',
|
||||
callback=request_callback,
|
||||
content_type='application/json',
|
||||
)
|
||||
|
||||
resp = requests.post(
|
||||
'http://calc.com/sum',
|
||||
json.dumps({'numbers': [1, 2, 3]}),
|
||||
headers={'content-type': 'application/json'},
|
||||
)
|
||||
|
||||
assert resp.json() == {'value': 6}
|
||||
|
||||
assert len(responses.calls) == 1
|
||||
assert responses.calls[0].request.url == 'http://calc.com/sum'
|
||||
assert responses.calls[0].response.text == '{"value": 6}'
|
||||
assert (
|
||||
responses.calls[0].response.headers['request-id'] ==
|
||||
'728d329e-0e86-11e4-a748-0c84dc037c13'
|
||||
)
|
||||
|
||||
Instead of passing a string URL into `responses.add` or `responses.add_callback`
|
||||
you can also supply a compiled regular expression.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
import re
|
||||
import responses
|
||||
import requests
|
||||
|
||||
# Instead of
|
||||
responses.add(responses.GET, 'http://twitter.com/api/1/foobar',
|
||||
body='{"error": "not found"}', status=404,
|
||||
content_type='application/json')
|
||||
|
||||
# You can do the following
|
||||
url_re = re.compile(r'https?://twitter.com/api/\d+/foobar')
|
||||
responses.add(responses.GET, url_re,
|
||||
body='{"error": "not found"}', status=404,
|
||||
content_type='application/json')
|
||||
|
||||
A response can also throw an exception as follows.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
import responses
|
||||
import requests
|
||||
from requests.exceptions import HTTPError
|
||||
|
||||
exception = HTTPError('Something went wrong')
|
||||
responses.add(responses.GET, 'http://twitter.com/api/1/foobar',
|
||||
body=exception)
|
||||
# All calls to 'http://twitter.com/api/1/foobar' will throw exception.
|
||||
|
||||
|
||||
Responses as a context manager
|
||||
------------------------------
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
import responses
|
||||
import requests
|
||||
|
||||
|
||||
def test_my_api():
|
||||
with responses.RequestsMock() as rsps:
|
||||
rsps.add(responses.GET, 'http://twitter.com/api/1/foobar',
|
||||
body='{}', status=200,
|
||||
content_type='application/json')
|
||||
resp = requests.get('http://twitter.com/api/1/foobar')
|
||||
|
||||
assert resp.status_code == 200
|
||||
|
||||
# outside the context manager requests will hit the remote server
|
||||
resp = requests.get('http://twitter.com/api/1/foobar')
|
||||
resp.status_code == 404
|
||||
|
||||
|
||||
Assertions on declared responses
|
||||
--------------------------------
|
||||
|
||||
By default Responses will raise an assertion error if a url was registered but not accessed. This
|
||||
can be disabled by passing the ``assert_all_requests_are_fired`` value:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
import responses
|
||||
import requests
|
||||
|
||||
|
||||
def test_my_api():
|
||||
with responses.RequestsMock(assert_all_requests_are_fired=False) as rsps:
|
||||
rsps.add(responses.GET, 'http://twitter.com/api/1/foobar',
|
||||
body='{}', status=200,
|
||||
content_type='application/json')
|
||||
|
||||
|
||||
9
deps/responses-0.5.1.dist-info/RECORD
vendored
Normal file
9
deps/responses-0.5.1.dist-info/RECORD
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
responses.py,sha256=vrUzcOahwpsf-rdHZxgow09ujSoMNhJTb-2u5KY4Lb4,9185
|
||||
responses-0.5.1.dist-info/DESCRIPTION.rst,sha256=U5-ekV_0ceIVR1DMXJO0qnUuc4q-U0Ujd1rRHGAPJ-Y,5021
|
||||
responses-0.5.1.dist-info/METADATA,sha256=H6v_eI-KLPr2GPZM528M8e_qV2lVYwY5Rf5J97fBNIs,5898
|
||||
responses-0.5.1.dist-info/RECORD,,
|
||||
responses-0.5.1.dist-info/WHEEL,sha256=GrqQvamwgBV4nLoJe0vhYRSWzWsx7xjlt74FT0SWYfE,110
|
||||
responses-0.5.1.dist-info/metadata.json,sha256=lFS6ndIP5zC0lyC2FKPRdXAeA32Q1nbdPFPEI-tL36M,1038
|
||||
responses-0.5.1.dist-info/top_level.txt,sha256=aQhzfC0bq4TkAaB_Yr-7cv4u2Xnc8WiVzvh4KdZo0Qo,10
|
||||
responses-0.5.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
|
||||
__pycache__/responses.cpython-34.pyc,,
|
||||
6
deps/responses-0.5.1.dist-info/WHEEL
vendored
Normal file
6
deps/responses-0.5.1.dist-info/WHEEL
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
Wheel-Version: 1.0
|
||||
Generator: bdist_wheel (0.26.0)
|
||||
Root-Is-Purelib: true
|
||||
Tag: py2-none-any
|
||||
Tag: py3-none-any
|
||||
|
||||
1
deps/responses-0.5.1.dist-info/metadata.json
vendored
Normal file
1
deps/responses-0.5.1.dist-info/metadata.json
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"generator": "bdist_wheel (0.26.0)", "summary": "A utility library for mocking out the `requests` Python library.", "classifiers": ["Intended Audience :: Developers", "Intended Audience :: System Administrators", "Operating System :: OS Independent", "Programming Language :: Python :: 2", "Programming Language :: Python :: 3", "Topic :: Software Development"], "extensions": {"python.details": {"project_urls": {"Home": "https://github.com/getsentry/responses"}, "contacts": [{"name": "David Cramer", "role": "author"}], "document_names": {"description": "DESCRIPTION.rst"}}}, "license": "Apache 2.0", "metadata_version": "2.0", "name": "responses", "extras": ["tests"], "run_requires": [{"requires": ["cookies", "requests (>=2.0)", "six"]}, {"requires": ["coverage (>=3.7.1,<5.0.0)", "flake8", "pytest-cov", "pytest"], "extra": "tests"}, {"requires": ["mock"], "environment": "python_version in \"2.6, 2.7, 3.2\""}], "version": "0.5.1", "test_requires": [{"requires": ["coverage (>=3.7.1,<5.0.0)", "flake8", "pytest", "pytest-cov"]}]}
|
||||
1
deps/responses-0.5.1.dist-info/top_level.txt
vendored
Normal file
1
deps/responses-0.5.1.dist-info/top_level.txt
vendored
Normal file
@@ -0,0 +1 @@
|
||||
responses
|
||||
Reference in New Issue
Block a user