🔀 Merge branch '4-ease-testing-over-an-api'

Resolve "ease testing over an API"

*  Add HTTP request recording for tests #6

Closes #4

See merge request forga/tool/ovh/ldpy!6
This commit is contained in:
Freezed 2022-09-28 22:57:13 +00:00
commit e1a51ef595
3 changed files with 6 additions and 0 deletions

1
.gitignore vendored
View File

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

View File

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

View File

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