mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2025-11-01 08:51:47 +01:00
testing/vdirsyncer: upgrade to 0.19.1
This commit is contained in:
parent
d0f69114d3
commit
b2d3a7d96f
@ -1,113 +0,0 @@
|
|||||||
# From https://github.com/pimutils/vdirsyncer/pull/903
|
|
||||||
diff --git a/tests/system/conftest.py b/tests/system/conftest.py
|
|
||||||
new file mode 100644
|
|
||||||
index 00000000..59271e57
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/tests/system/conftest.py
|
|
||||||
@@ -0,0 +1,26 @@
|
|
||||||
+import ssl
|
|
||||||
+
|
|
||||||
+import pytest
|
|
||||||
+import trustme
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+@pytest.fixture(scope="session")
|
|
||||||
+def ca():
|
|
||||||
+ return trustme.CA()
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+@pytest.fixture(scope="session")
|
|
||||||
+def localhost_cert(ca):
|
|
||||||
+ return ca.issue_cert("localhost")
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+@pytest.fixture(scope="session")
|
|
||||||
+def httpserver_ssl_context(localhost_cert):
|
|
||||||
+ context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
|
|
||||||
+
|
|
||||||
+ crt = localhost_cert.cert_chain_pems[0]
|
|
||||||
+ key = localhost_cert.private_key_pem
|
|
||||||
+ with crt.tempfile() as crt_file, key.tempfile() as key_file:
|
|
||||||
+ context.load_cert_chain(crt_file, key_file)
|
|
||||||
+
|
|
||||||
+ return context
|
|
||||||
diff --git a/tests/system/utils/test_main.py b/tests/system/utils/test_main.py
|
|
||||||
index 5a3942db..db3e70fd 100644
|
|
||||||
--- a/tests/system/utils/test_main.py
|
|
||||||
+++ b/tests/system/utils/test_main.py
|
|
||||||
@@ -4,6 +4,8 @@
|
|
||||||
import click_log
|
|
||||||
import pytest
|
|
||||||
import requests
|
|
||||||
+from cryptography import x509
|
|
||||||
+from cryptography.hazmat.primitives import hashes
|
|
||||||
|
|
||||||
from vdirsyncer import http
|
|
||||||
from vdirsyncer import utils
|
|
||||||
@@ -38,27 +40,55 @@ def _fingerprints_broken():
|
|
||||||
return broken_urllib3
|
|
||||||
|
|
||||||
|
|
||||||
+def fingerprint_of_cert(cert, hash=hashes.SHA256):
|
|
||||||
+ return x509.load_pem_x509_certificate(cert.bytes()).fingerprint(hash()).hex()
|
|
||||||
+
|
|
||||||
+
|
|
||||||
@pytest.mark.skipif(
|
|
||||||
_fingerprints_broken(), reason="https://github.com/shazow/urllib3/issues/529"
|
|
||||||
)
|
|
||||||
-@pytest.mark.parametrize(
|
|
||||||
- "fingerprint",
|
|
||||||
- [
|
|
||||||
- "94:FD:7A:CB:50:75:A4:69:82:0A:F8:23:DF:07:FC:69:3E:CD:90:CA",
|
|
||||||
- "19:90:F7:23:94:F2:EF:AB:2B:64:2D:57:3D:25:95:2D",
|
|
||||||
- ],
|
|
||||||
+@pytest.mark.parametrize("hash_algorithm", [hashes.MD5, hashes.SHA256])
|
|
||||||
+def test_request_ssl_leaf_fingerprint(httpserver, localhost_cert, hash_algorithm):
|
|
||||||
+ fingerprint = fingerprint_of_cert(localhost_cert.cert_chain_pems[0], hash_algorithm)
|
|
||||||
+
|
|
||||||
+ # We have to serve something:
|
|
||||||
+ httpserver.expect_request("/").respond_with_data("OK")
|
|
||||||
+ url = f"https://{httpserver.host}:{httpserver.port}/"
|
|
||||||
+
|
|
||||||
+ http.request("GET", url, verify=False, verify_fingerprint=fingerprint)
|
|
||||||
+ with pytest.raises(requests.exceptions.ConnectionError) as excinfo:
|
|
||||||
+ http.request("GET", url, verify_fingerprint=fingerprint)
|
|
||||||
+
|
|
||||||
+ with pytest.raises(requests.exceptions.ConnectionError) as excinfo:
|
|
||||||
+ http.request(
|
|
||||||
+ "GET",
|
|
||||||
+ url,
|
|
||||||
+ verify=False,
|
|
||||||
+ verify_fingerprint="".join(reversed(fingerprint)),
|
|
||||||
+ )
|
|
||||||
+ assert "Fingerprints did not match" in str(excinfo.value)
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+@pytest.mark.skipif(
|
|
||||||
+ _fingerprints_broken(), reason="https://github.com/shazow/urllib3/issues/529"
|
|
||||||
)
|
|
||||||
-def test_request_ssl_fingerprints(httpsserver, fingerprint):
|
|
||||||
- httpsserver.serve_content("") # we need to serve something
|
|
||||||
+@pytest.mark.xfail(reason="Not implemented")
|
|
||||||
+@pytest.mark.parametrize("hash_algorithm", [hashes.MD5, hashes.SHA256])
|
|
||||||
+def test_request_ssl_ca_fingerprint(httpserver, ca, hash_algorithm):
|
|
||||||
+ fingerprint = fingerprint_of_cert(ca.cert_pem)
|
|
||||||
+
|
|
||||||
+ # We have to serve something:
|
|
||||||
+ httpserver.expect_request("/").respond_with_data("OK")
|
|
||||||
+ url = f"https://{httpserver.host}:{httpserver.port}/"
|
|
||||||
|
|
||||||
- http.request("GET", httpsserver.url, verify=False, verify_fingerprint=fingerprint)
|
|
||||||
+ http.request("GET", url, verify=False, verify_fingerprint=fingerprint)
|
|
||||||
with pytest.raises(requests.exceptions.ConnectionError) as excinfo:
|
|
||||||
- http.request("GET", httpsserver.url, verify_fingerprint=fingerprint)
|
|
||||||
+ http.request("GET", url, verify_fingerprint=fingerprint)
|
|
||||||
|
|
||||||
with pytest.raises(requests.exceptions.ConnectionError) as excinfo:
|
|
||||||
http.request(
|
|
||||||
"GET",
|
|
||||||
- httpsserver.url,
|
|
||||||
+ url,
|
|
||||||
verify=False,
|
|
||||||
verify_fingerprint="".join(reversed(fingerprint)),
|
|
||||||
)
|
|
||||||
@ -2,24 +2,27 @@
|
|||||||
# Maintainer: Galen Abell <galen@galenabell.com>
|
# Maintainer: Galen Abell <galen@galenabell.com>
|
||||||
pkgname=vdirsyncer
|
pkgname=vdirsyncer
|
||||||
_pyname=$pkgname
|
_pyname=$pkgname
|
||||||
pkgver=0.18.0
|
pkgver=0.19.1
|
||||||
pkgrel=2
|
pkgrel=0
|
||||||
pkgdesc="CLI Synchronization for CalDAV and CardDAV"
|
pkgdesc="CLI Synchronization for CalDAV and CardDAV"
|
||||||
url="http://vdirsyncer.pimutils.org"
|
url="http://vdirsyncer.pimutils.org"
|
||||||
arch="noarch"
|
arch="noarch"
|
||||||
license="BSD-3-Clause"
|
license="BSD-3-Clause"
|
||||||
depends="
|
depends="
|
||||||
python3
|
python3
|
||||||
|
py3-aiohttp
|
||||||
|
py3-aiostream
|
||||||
py3-atomicwrites
|
py3-atomicwrites
|
||||||
py3-click
|
py3-click
|
||||||
py3-click-log
|
py3-click-log
|
||||||
py3-click-threading
|
|
||||||
py3-requests
|
py3-requests
|
||||||
py3-requests-toolbelt
|
py3-requests-toolbelt
|
||||||
"
|
"
|
||||||
makedepends="py3-setuptools py3-setuptools_scm py3-sphinx"
|
makedepends="py3-build py3-installer py3-wheel py3-setuptools_scm py3-sphinx"
|
||||||
checkdepends="
|
checkdepends="
|
||||||
|
py3-aioresponses
|
||||||
py3-pytest
|
py3-pytest
|
||||||
|
py3-pytest-asyncio
|
||||||
py3-pytest-cov
|
py3-pytest-cov
|
||||||
py3-pytest-httpserver
|
py3-pytest-httpserver
|
||||||
py3-hypothesis
|
py3-hypothesis
|
||||||
@ -28,25 +31,26 @@ checkdepends="
|
|||||||
py3-werkzeug
|
py3-werkzeug
|
||||||
"
|
"
|
||||||
subpackages="$pkgname-doc"
|
subpackages="$pkgname-doc"
|
||||||
source="https://files.pythonhosted.org/packages/source/${_pyname%"${_pyname#?}"}/$_pyname/$_pyname-$pkgver.tar.gz
|
source="https://files.pythonhosted.org/packages/source/v/$_pyname/$_pyname-$pkgver.tar.gz
|
||||||
01-fix-ssl-tests.patch"
|
"
|
||||||
|
|
||||||
build() {
|
build() {
|
||||||
python3 setup.py build
|
python3 -m build --wheel --skip-dependency-check --no-isolation
|
||||||
PYTHONPATH="build:$PYTHONPATH" sphinx-build -b man docs/ build/
|
PYTHONPATH="build:$PYTHONPATH" sphinx-build -b man docs/ build/
|
||||||
}
|
}
|
||||||
|
|
||||||
check() {
|
check() {
|
||||||
# test_request_ssl requires network
|
# test_request_ssl requires network
|
||||||
make DETERMINISTIC_TESTS=true PYTEST_ADDOPTS="--deselect tests/system/utils/test_main.py::test_request_ssl" test
|
python3 -m venv --clear --without-pip --system-site-packages testenv
|
||||||
|
testenv/bin/python3 -m installer dist/*.whl
|
||||||
|
DETERMINISTIC_TESTS=true testenv/bin/python3 -m pytest --deselect tests/system/utils/test_main.py::test_request_ssl
|
||||||
}
|
}
|
||||||
|
|
||||||
package() {
|
package() {
|
||||||
python3 setup.py install --skip-build --root="$pkgdir"
|
python3 -m installer -d "$pkgdir" dist/*.whl
|
||||||
install -Dm644 build/$pkgname.1 "$pkgdir"/usr/share/man/man1/$pkgname.1
|
install -Dm644 build/$pkgname.1 "$pkgdir"/usr/share/man/man1/$pkgname.1
|
||||||
}
|
}
|
||||||
|
|
||||||
sha512sums="
|
sha512sums="
|
||||||
7fb3d0f7d982d8390d278de1a620231e6ead1ec64057c5dbac98dcff491fa3e6b9ed8ba953995458e393aab73b0b9ab8ba14010e06f90a04d8ee2c28c7c7fbfd vdirsyncer-0.18.0.tar.gz
|
2b0917bf69cfa298600b6b35b50db12ca57e1a963baf2ea9839a3c2f9f686f2f83f47c01e44ad2e12287ecfd470fe1a9ee4a756c0f8985236c2fe8d0454b6a15 vdirsyncer-0.19.1.tar.gz
|
||||||
09493b5298212fc724b3dfd2a5cffe89fae0857ee1e0a27eb272bf5960b03bac2c0cc8e18a2b9b58de13b8287c2377b1d2fb22b725f10fb243777faa9fd2d3b2 01-fix-ssl-tests.patch
|
|
||||||
"
|
"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user