Date: Sunday, April 9, 2023 @ 04:18:10 Author: felixonmars Revision: 1443121
archrelease: copy trunk to community-staging-any Added: python-threat9-test-bed/repos/community-staging-any/ python-threat9-test-bed/repos/community-staging-any/PKGBUILD (from rev 1443120, python-threat9-test-bed/trunk/PKGBUILD) python-threat9-test-bed/repos/community-staging-any/http-service-async-mock.patch (from rev 1443120, python-threat9-test-bed/trunk/http-service-async-mock.patch) -------------------------------+ PKGBUILD | 48 ++++++++++++++++++++++++++++++++++++++ http-service-async-mock.patch | 50 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 98 insertions(+) Copied: python-threat9-test-bed/repos/community-staging-any/PKGBUILD (from rev 1443120, python-threat9-test-bed/trunk/PKGBUILD) =================================================================== --- community-staging-any/PKGBUILD (rev 0) +++ community-staging-any/PKGBUILD 2023-04-09 04:18:10 UTC (rev 1443121) @@ -0,0 +1,48 @@ +# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org> + +pkgname=python-threat9-test-bed +_pyname=threat9-test-bed +_gitcommit=1ed61b34d0b138711e3f8267259cdb29787fe349 +pkgver=0.6.0+2+g1ed61b3 +pkgrel=9 +pkgdesc='Threat9 Test Bed' +url='https://github.com/threat9/threat9-test-bed' +arch=('any') +license=('custom') +depends=('python' 'python-click' 'python-faker' 'python-flask' + 'python-asgiref' 'gunicorn' 'python-pyopenssl' 'python-requests') +makedepends=('git' 'python-build' 'python-installer' 'python-setuptools-scm' 'python-setuptools' 'python-wheel') +checkdepends=('python-pytest') +source=(${pkgname}::"git+https://github.com/threat9/threat9-test-bed#commit=${_gitcommit}" + http-service-async-mock.patch) +sha512sums=('SKIP' + '50ce00674dbf9878f09b27397af2f062fab8a71b11e66b49eb710876b49812ce95c93f4ee55bf1ad103b6f5d5b48b86c826a5adc2f9fddeb393ff6bddc650839') + +pkgver() { + cd ${pkgname} + git describe --always --tags | sed 's/^v//;s/-/+/g' +} + +prepare() { + cd ${pkgname} + # not sure why this works lol + patch -Np1 -i ../http-service-async-mock.patch +} + +build() { + cd ${pkgname} + python -m build --wheel --no-isolation +} + +check() { + cd ${pkgname} + python -m pytest +} + +package() { + cd ${pkgname} + python -m installer --destdir="$pkgdir" dist/*.whl + install -Dm 644 README.md -t "${pkgdir}/usr/share/doc/${pkgname}" +} + +# vim: ts=2 sw=2 et: Copied: python-threat9-test-bed/repos/community-staging-any/http-service-async-mock.patch (from rev 1443120, python-threat9-test-bed/trunk/http-service-async-mock.patch) =================================================================== --- community-staging-any/http-service-async-mock.patch (rev 0) +++ community-staging-any/http-service-async-mock.patch 2023-04-09 04:18:10 UTC (rev 1443121) @@ -0,0 +1,50 @@ +diff --git a/tests/service_mocks/test_http_service_mock.py b/tests/service_mocks/test_http_service_mock.py +index bc04eb3..9f042f1 100644 +--- a/tests/service_mocks/test_http_service_mock.py ++++ b/tests/service_mocks/test_http_service_mock.py +@@ -1,4 +1,4 @@ +-from unittest.mock import MagicMock ++from unittest.mock import AsyncMock + + import requests + +@@ -11,7 +11,7 @@ def test_http_service_mock(): + assert target.port == 8080 + mock = target.get_route_mock("/foo", methods=["POST"]) + mock.return_value = "bar", 201 +- assert isinstance(mock, MagicMock) ++ assert isinstance(mock, AsyncMock) + response = requests.post(f"http://{target.host}:{target.port}/foo") + assert response.status_code == 201 + assert response.content == b"bar" +@@ -23,7 +23,7 @@ def test_https_service_mock(): + assert target.port == 8080 + mock = target.get_route_mock("/foo", methods=["POST"]) + mock.return_value = "bar", 201 +- assert isinstance(mock, MagicMock) ++ assert isinstance(mock, AsyncMock) + response = requests.post(f"https://{target.host}:{target.port}/foo", + verify=False) + assert response.status_code == 201 +@@ -36,7 +36,7 @@ def test_http_service_mock_random_port(): + assert target.port in range(1024, 65535 + 1) + mock = target.get_route_mock("/foo", methods=["POST"]) + mock.return_value = "bar", 201 +- assert isinstance(mock, MagicMock) ++ assert isinstance(mock, AsyncMock) + response = requests.post(f"http://{target.host}:{target.port}/foo", + verify=False) + assert response.status_code == 201 +diff --git a/threat9_test_bed/service_mocks/http_service_mock.py b/threat9_test_bed/service_mocks/http_service_mock.py +index a2cecd6..5642ef3 100644 +--- a/threat9_test_bed/service_mocks/http_service_mock.py ++++ b/threat9_test_bed/service_mocks/http_service_mock.py +@@ -13,7 +13,7 @@ class HttpServiceMock(WerkzeugBasedHttpService): + super().__init__(host, port, Flask("target"), ssl) + + def get_route_mock(self, rule, **options): +- mocked_view = mock.MagicMock(name=rule, spec=lambda: None) ++ mocked_view = mock.AsyncMock(name=rule, spec=lambda: None) + self.app.add_url_rule(rule, + endpoint=rule, + view_func=mocked_view,