Add HTTP request recording for tests #6

This commit is contained in:
Freezed 2022-09-29 00:25:07 +02:00
parent 645fd3a5da
commit d7a604528d
3 changed files with 6 additions and 0 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
cassettes
client.py client.py
.coverage .coverage
htmlcov htmlcov

View File

@ -6,4 +6,5 @@ pylint
pyproject-flake8 pyproject-flake8
pytest pytest
pytest-cov pytest-cov
pytest-vcr
toml toml

View File

@ -9,6 +9,7 @@ Author: frederic zind 2022-09-24
Licenses: GNU AGPL v3: http://www.gnu.org/licenses/ Licenses: GNU AGPL v3: http://www.gnu.org/licenses/
""" """
import logging import logging
import pytest
from pytest import mark, raises from pytest import mark, raises
import ldpy import ldpy
@ -128,6 +129,7 @@ def test_get_last_entries_out_of_range(entry_np):
ldpy.get_last_entries(entry_np) ldpy.get_last_entries(entry_np)
@pytest.mark.vcr()
@mark.parametrize("entry_np", LAST_E_CHOICES) @mark.parametrize("entry_np", LAST_E_CHOICES)
def test_get_last_entries_in_range(entry_np): def test_get_last_entries_in_range(entry_np):
"""Value is in range for the last entries.""" """Value is in range for the last entries."""
@ -146,6 +148,7 @@ def test_main_without_option():
ldpy.main(options) ldpy.main(options)
@pytest.mark.vcr()
def test_main_demo_with_mapping(): def test_main_demo_with_mapping():
"""Called with mapping option. """Called with mapping option.
@ -157,6 +160,7 @@ def test_main_demo_with_mapping():
assert isinstance(response, list) assert isinstance(response, list)
@pytest.mark.vcr()
def test_main_demo_with_last_const(): def test_main_demo_with_last_const():
"""Called with last option.""" """Called with last option."""
options = FakeOptions(["last"]) options = FakeOptions(["last"])