From d7a604528dbaa88be5b1e2e1385f2d77e2f56303 Mon Sep 17 00:00:00 2001 From: Freezed <2160318-free_zed@users.noreply.gitlab.com> Date: Thu, 29 Sep 2022 00:25:07 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=85=20Add=20HTTP=20request=20recording=20?= =?UTF-8?q?for=20tests=20#6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + requirements-dev.txt | 1 + tests_ldpy.py | 4 ++++ 3 files changed, 6 insertions(+) diff --git a/.gitignore b/.gitignore index eba8e8f..6806920 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +cassettes client.py .coverage htmlcov diff --git a/requirements-dev.txt b/requirements-dev.txt index 6c6bf80..4e67882 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -6,4 +6,5 @@ pylint pyproject-flake8 pytest pytest-cov +pytest-vcr toml diff --git a/tests_ldpy.py b/tests_ldpy.py index 14a7eff..cf57fdd 100644 --- a/tests_ldpy.py +++ b/tests_ldpy.py @@ -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"])