__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
import pytest
import responses
from responses import registries
from responses.test_responses import assert_reset
def test_set_registry_not_empty():
class CustomRegistry(registries.FirstMatchRegistry):
pass
@responses.activate
def run():
url = "http://fizzbuzz/foo"
responses.add(method=responses.GET, url=url)
with pytest.raises(AttributeError) as excinfo:
responses.mock._set_registry(CustomRegistry)
msg = str(excinfo.value)
assert "Cannot replace Registry, current registry has responses" in msg
run()
assert_reset()
def test_set_registry():
class CustomRegistry(registries.FirstMatchRegistry):
pass
@responses.activate(registry=CustomRegistry)
def run_with_registry():
assert type(responses.mock._get_registry()) == CustomRegistry
@responses.activate
def run():
# test that registry does not leak to another test
assert type(responses.mock._get_registry()) == registries.FirstMatchRegistry
run_with_registry()
run()
assert_reset()
def test_set_registry_context_manager():
def run():
class CustomRegistry(registries.FirstMatchRegistry):
pass
with responses.RequestsMock(
assert_all_requests_are_fired=False, registry=CustomRegistry
) as rsps:
assert type(rsps._get_registry()) == CustomRegistry
assert type(responses.mock._get_registry()) == registries.FirstMatchRegistry
run()
assert_reset()
def test_registry_reset():
def run():
class CustomRegistry(registries.FirstMatchRegistry):
pass
with responses.RequestsMock(
assert_all_requests_are_fired=False, registry=CustomRegistry
) as rsps:
rsps._get_registry().reset()
assert not rsps.registered()
run()
assert_reset()
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| __pycache__ | Folder | 0755 |
|
|
| __init__.py | File | 25.27 KB | 0644 |
|
| __init__.pyi | File | 10.24 KB | 0644 |
|
| matchers.py | File | 9.94 KB | 0644 |
|
| matchers.pyi | File | 946 B | 0644 |
|
| registries.py | File | 2.02 KB | 0644 |
|
| test_matchers.py | File | 19.29 KB | 0644 |
|
| test_registries.py | File | 1.86 KB | 0644 |
|
| test_responses.py | File | 56.06 KB | 0644 |
|