1
0
mirror of https://github.com/kevin1024/vcrpy.git synced 2025-12-08 16:53:23 +00:00

Spelling fixes

This commit is contained in:
Ville Skyttä
2021-08-16 06:56:36 +03:00
parent d4927627c3
commit 678d56f608
6 changed files with 24 additions and 24 deletions

View File

@@ -1,7 +1,7 @@
Changelog Changelog
--------- ---------
For a full list of triaged issues, bugs and PRs and what release they are targetted for please see the following link. For a full list of triaged issues, bugs and PRs and what release they are targeted for please see the following link.
`ROADMAP MILESTONES <https://github.com/kevin1024/vcrpy/milestones>`_ `ROADMAP MILESTONES <https://github.com/kevin1024/vcrpy/milestones>`_
@@ -100,7 +100,7 @@ All help in providing PRs to close out bug issues is appreciated. Even if that i
- decode_compressed_response option and filter (thanks @jayvdb). - decode_compressed_response option and filter (thanks @jayvdb).
- 1.7.4 [#217] - 1.7.4 [#217]
- Make use_cassette decorated functions actually return a value (thanks @bcen). - Make use_cassette decorated functions actually return a value (thanks @bcen).
- [#199] Fix path transfromation defaults. - [#199] Fix path transformation defaults.
- Better headers dictionary management. - Better headers dictionary management.
- 1.7.3 [#188] - 1.7.3 [#188]
- ``additional_matchers`` kwarg on ``use_cassette``. - ``additional_matchers`` kwarg on ``use_cassette``.
@@ -203,7 +203,7 @@ All help in providing PRs to close out bug issues is appreciated. Even if that i
- 0.3.4 - 0.3.4
- Bugfix: close file before renaming it. This fixes an issue on Windows. Thanks @smallcode for the fix. - Bugfix: close file before renaming it. This fixes an issue on Windows. Thanks @smallcode for the fix.
- 0.3.3 - 0.3.3
- Bugfix for error message when an unreigstered custom matcher was used - Bugfix for error message when an unregistered custom matcher was used
- 0.3.2 - 0.3.2
- Fix issue with new config syntax and the ``match_on`` parameter. Thanks, @chromy! - Fix issue with new config syntax and the ``match_on`` parameter. Thanks, @chromy!
- 0.3.1 - 0.3.1

View File

@@ -208,7 +208,7 @@ def test_nesting_cassette_context_managers(*args):
) )
assert_get_response_body_is("first_response") assert_get_response_body_is("first_response")
# Make sure a second cassette can supercede the first # Make sure a second cassette can supersede the first
with Cassette.use(path="test") as second_cassette: with Cassette.use(path="test") as second_cassette:
with mock.patch.object(second_cassette, "play_response", return_value=second_response): with mock.patch.object(second_cassette, "play_response", return_value=second_response):
assert_get_response_body_is("second_response") assert_get_response_body_is("second_response")
@@ -310,16 +310,16 @@ def test_func_path_generator():
def test_use_as_decorator_on_coroutine(): def test_use_as_decorator_on_coroutine():
original_http_connetion = httplib.HTTPConnection original_http_connection = httplib.HTTPConnection
@Cassette.use(inject=True) @Cassette.use(inject=True)
def test_function(cassette): def test_function(cassette):
assert httplib.HTTPConnection.cassette is cassette assert httplib.HTTPConnection.cassette is cassette
assert httplib.HTTPConnection is not original_http_connetion assert httplib.HTTPConnection is not original_http_connection
value = yield 1 value = yield 1
assert value == 1 assert value == 1
assert httplib.HTTPConnection.cassette is cassette assert httplib.HTTPConnection.cassette is cassette
assert httplib.HTTPConnection is not original_http_connetion assert httplib.HTTPConnection is not original_http_connection
value = yield 2 value = yield 2
assert value == 2 assert value == 2
@@ -333,15 +333,15 @@ def test_use_as_decorator_on_coroutine():
def test_use_as_decorator_on_generator(): def test_use_as_decorator_on_generator():
original_http_connetion = httplib.HTTPConnection original_http_connection = httplib.HTTPConnection
@Cassette.use(inject=True) @Cassette.use(inject=True)
def test_function(cassette): def test_function(cassette):
assert httplib.HTTPConnection.cassette is cassette assert httplib.HTTPConnection.cassette is cassette
assert httplib.HTTPConnection is not original_http_connetion assert httplib.HTTPConnection is not original_http_connection
yield 1 yield 1
assert httplib.HTTPConnection.cassette is cassette assert httplib.HTTPConnection.cassette is cassette
assert httplib.HTTPConnection is not original_http_connetion assert httplib.HTTPConnection is not original_http_connection
yield 2 yield 2
assert list(test_function()) == [1, 2] assert list(test_function()) == [1, 2]

View File

@@ -6,7 +6,7 @@ from vcr.cassette import Cassette
class TestVCRConnection: class TestVCRConnection:
def test_setting_of_attributes_get_propogated_to_real_connection(self): def test_setting_of_attributes_get_propagated_to_real_connection(self):
vcr_connection = VCRHTTPSConnection("www.examplehost.com") vcr_connection = VCRHTTPSConnection("www.examplehost.com")
vcr_connection.ssl_version = "example_ssl_version" vcr_connection.ssl_version = "example_ssl_version"
assert vcr_connection.real_connection.ssl_version == "example_ssl_version" assert vcr_connection.real_connection.ssl_version == "example_ssl_version"

View File

@@ -31,7 +31,7 @@ def test_vcr_use_cassette():
function() function()
assert mock_cassette_load.call_args[1]["record_mode"] == test_vcr.record_mode assert mock_cassette_load.call_args[1]["record_mode"] == test_vcr.record_mode
# Ensure that explicitly provided arguments still supercede # Ensure that explicitly provided arguments still supersede
# those on the vcr. # those on the vcr.
new_record_mode = mock.Mock() new_record_mode = mock.Mock()
@@ -226,7 +226,7 @@ def test_with_current_defaults():
def test_cassette_library_dir_with_decoration_and_no_explicit_path(): def test_cassette_library_dir_with_decoration_and_no_explicit_path():
library_dir = "/libary_dir" library_dir = "/library_dir"
vcr = VCR(inject_cassette=True, cassette_library_dir=library_dir) vcr = VCR(inject_cassette=True, cassette_library_dir=library_dir)
@vcr.use_cassette() @vcr.use_cassette()
@@ -237,7 +237,7 @@ def test_cassette_library_dir_with_decoration_and_no_explicit_path():
def test_cassette_library_dir_with_decoration_and_explicit_path(): def test_cassette_library_dir_with_decoration_and_explicit_path():
library_dir = "/libary_dir" library_dir = "/library_dir"
vcr = VCR(inject_cassette=True, cassette_library_dir=library_dir) vcr = VCR(inject_cassette=True, cassette_library_dir=library_dir)
@vcr.use_cassette(path="custom_name") @vcr.use_cassette(path="custom_name")
@@ -248,7 +248,7 @@ def test_cassette_library_dir_with_decoration_and_explicit_path():
def test_cassette_library_dir_with_decoration_and_super_explicit_path(): def test_cassette_library_dir_with_decoration_and_super_explicit_path():
library_dir = "/libary_dir" library_dir = "/library_dir"
vcr = VCR(inject_cassette=True, cassette_library_dir=library_dir) vcr = VCR(inject_cassette=True, cassette_library_dir=library_dir)
@vcr.use_cassette(path=os.path.join(library_dir, "custom_name")) @vcr.use_cassette(path=os.path.join(library_dir, "custom_name"))
@@ -259,7 +259,7 @@ def test_cassette_library_dir_with_decoration_and_super_explicit_path():
def test_cassette_library_dir_with_path_transformer(): def test_cassette_library_dir_with_path_transformer():
library_dir = "/libary_dir" library_dir = "/library_dir"
vcr = VCR( vcr = VCR(
inject_cassette=True, cassette_library_dir=library_dir, path_transformer=lambda path: path + ".json" inject_cassette=True, cassette_library_dir=library_dir, path_transformer=lambda path: path + ".json"
) )

View File

@@ -3,7 +3,7 @@ from enum import Enum
class RecordMode(str, Enum): class RecordMode(str, Enum):
""" """
Configues when VCR will record to the cassette. Configures when VCR will record to the cassette.
Can be declared by either using the enumerated value (`vcr.mode.ONCE`) Can be declared by either using the enumerated value (`vcr.mode.ONCE`)
or by simply using the defined string (`once`). or by simply using the defined string (`once`).

View File

@@ -10,26 +10,26 @@ from vcr.errors import CannotOverwriteExistingCassetteException
_logger = logging.getLogger(__name__) _logger = logging.getLogger(__name__)
def _transform_headers(httpx_reponse): def _transform_headers(httpx_response):
""" """
Some headers can appear multiple times, like "Set-Cookie". Some headers can appear multiple times, like "Set-Cookie".
Therefore transform to every header key to list of values. Therefore transform to every header key to list of values.
""" """
out = {} out = {}
for key, var in httpx_reponse.headers.raw: for key, var in httpx_response.headers.raw:
decoded_key = key.decode("utf-8") decoded_key = key.decode("utf-8")
out.setdefault(decoded_key, []) out.setdefault(decoded_key, [])
out[decoded_key].append(var.decode("utf-8")) out[decoded_key].append(var.decode("utf-8"))
return out return out
def _to_serialized_response(httpx_reponse): def _to_serialized_response(httpx_response):
return { return {
"status_code": httpx_reponse.status_code, "status_code": httpx_response.status_code,
"http_version": httpx_reponse.http_version, "http_version": httpx_response.http_version,
"headers": _transform_headers(httpx_reponse), "headers": _transform_headers(httpx_response),
"content": httpx_reponse.content.decode("utf-8", "ignore"), "content": httpx_response.content.decode("utf-8", "ignore"),
} }