Add trivial integration tests for mTLS auth
This commit is contained in:
parent
12609b0400
commit
690e06d9db
2 changed files with 443 additions and 0 deletions
|
|
@ -8,6 +8,7 @@ Summary: Add PKCS12 support to the requests library
|
|||
License: ISC
|
||||
URL: https://github.com/m-click/requests_pkcs12
|
||||
Source0: %{url}/archive/%{version}/%{pypi_name}-%{version}.tar.gz
|
||||
Source1: test_integration.py
|
||||
BuildArch: noarch
|
||||
|
||||
%description
|
||||
|
|
@ -20,6 +21,11 @@ Summary: %{summary}
|
|||
|
||||
BuildRequires: python3-devel
|
||||
|
||||
# For tests
|
||||
BuildRequires: python3-requests
|
||||
BuildRequires: python3-pytest
|
||||
BuildRequires: openssl
|
||||
|
||||
%description -n python3-%{pypi_name}
|
||||
This library adds PKCS12 support to the Python requests library. It is
|
||||
integrated into requests as recommended by its authors: creating a custom
|
||||
|
|
@ -27,6 +33,7 @@ TransportAdapter, which provides a custom SSLContext.
|
|||
|
||||
%prep
|
||||
%autosetup -n requests_pkcs12-%{version}
|
||||
cp %{SOURCE1} .
|
||||
|
||||
%generate_buildrequires
|
||||
%pyproject_buildrequires
|
||||
|
|
@ -40,6 +47,16 @@ TransportAdapter, which provides a custom SSLContext.
|
|||
|
||||
%check
|
||||
%pyproject_check_import
|
||||
%{pytest} -v
|
||||
|
||||
# embeded test with connection to example.com
|
||||
# skip it with unavailable network (in koji)
|
||||
if getent hosts example.com; then
|
||||
PYTHONDONTWRITEBYTECODE=1 \
|
||||
PATH="%{buildroot}%{_bindir}:$PATH" \
|
||||
PYTHONPATH="${PYTHONPATH:-%{buildroot}%{python3_sitearch}:%{buildroot}%{python3_sitelib}}" \
|
||||
%{__python3} -c 'import requests_pkcs12; requests_pkcs12.test()'
|
||||
fi
|
||||
|
||||
%files -n python3-%{pypi_name} -f %{pyproject_files}
|
||||
%doc README.rst
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue