From 129a1fb4dbc375be0fa926964aa1be46a0cdbbef Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 14 Apr 2024 21:54:34 +0200 Subject: Adding upstream version 0.1.21. Signed-off-by: Daniel Baumann --- tests/plugin_tests/perl-openssl_test.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 tests/plugin_tests/perl-openssl_test.py (limited to 'tests/plugin_tests/perl-openssl_test.py') diff --git a/tests/plugin_tests/perl-openssl_test.py b/tests/plugin_tests/perl-openssl_test.py new file mode 100644 index 0000000..37f2ba1 --- /dev/null +++ b/tests/plugin_tests/perl-openssl_test.py @@ -0,0 +1,33 @@ +import stat +import os + +import pytest + +from debputy.plugin.api.test_api import ( + initialize_plugin_under_test, + build_virtual_file_system, + package_metadata_context, +) + +STUB_CMD = os.path.join(os.path.dirname(__file__), "perl-ssl_test.sh") + + +@pytest.fixture(scope="session") +def perl_ssl_stub_cmd() -> None: + os.environ["_PERL_SSL_DEFAULTS_TEST_PATH"] = STUB_CMD + mode = stat.S_IMODE(os.stat(STUB_CMD).st_mode) + if (mode & 0o500) != 0o500: + os.chmod(STUB_CMD, mode | 0o500) + yield + try: + del os.environ["_PERL_SSL_DEFAULTS_TEST_PATH"] + except KeyError: + pass + + +def test_perl_openssl(perl_ssl_stub_cmd) -> None: + plugin = initialize_plugin_under_test() + fs = build_virtual_file_system([]) + context = package_metadata_context(package_fields={"Architecture": "all"}) + metadata = plugin.run_metadata_detector("perl-openssl-abi", fs, context) + assert metadata.substvars["perl:Depends"] == "perl-openssl-abi-3" -- cgit v1.2.3