try to solve async issues

This commit is contained in:
Kenneth Kehl
2025-06-09 11:59:32 -07:00
parent e5dc5f12aa
commit 3672b16315
3 changed files with 47 additions and 68 deletions

21
poetry.lock generated
View File

@@ -2934,25 +2934,6 @@ pygments = ">=2.7.2"
[package.extras]
dev = ["argcomplete", "attrs (>=19.2)", "hypothesis (>=3.56)", "mock", "requests", "setuptools", "xmlschema"]
[[package]]
name = "pytest-asyncio"
version = "1.0.0"
description = "Pytest support for asyncio"
optional = false
python-versions = ">=3.9"
groups = ["dev"]
files = [
{file = "pytest_asyncio-1.0.0-py3-none-any.whl", hash = "sha256:4f024da9f1ef945e680dc68610b52550e36590a67fd31bb3b4943979a1f90ef3"},
{file = "pytest_asyncio-1.0.0.tar.gz", hash = "sha256:d15463d13f4456e1ead2594520216b225a16f781e144f8fdf6c5bb4667c48b3f"},
]
[package.dependencies]
pytest = ">=8.2,<9"
[package.extras]
docs = ["sphinx (>=5.3)", "sphinx-rtd-theme (>=1)"]
testing = ["coverage (>=6.2)", "hypothesis (>=5.7.1)"]
[[package]]
name = "pytest-base-url"
version = "2.1.0"
@@ -4184,4 +4165,4 @@ cffi = ["cffi (>=1.11)"]
[metadata]
lock-version = "2.1"
python-versions = "^3.12.2"
content-hash = "6f58a9c3cb0dd017d6f72710dd1a123b6d7b82f5fed1e001945dd8f5b8d83d8a"
content-hash = "ea33d62bdc72a35f193155bb8b478aed1a2a3b84e1266d976f33705cff226fc1"

View File

@@ -90,7 +90,6 @@ moto = "*"
pip-audit = "*"
pre-commit = "^4.2.0"
pytest = "^8.4.0"
pytest-asyncio = "^1.0.0"
pytest-env = "^1.1.3"
pytest-mock = "^3.14.1"
pytest-playwright = "^0.7.0"

View File

@@ -1784,53 +1784,52 @@ def test_should_not_create_sms_template_with_emoji(
assert mock_create_service_template.called is False
# @pytest.mark.asyncio
# @pytest.mark.parametrize(
# ("template_type", "expected_error"),
# [
# (
# "sms",
# (
# "Please remove the unaccepted character 🍔 in your message, then save again"
# ),
# ),
# ],
# )
# async def test_should_not_update_sms_template_with_emoji(
# mocker,
# client_request,
# service_one,
# mock_get_service_template,
# mock_update_service_template,
# fake_uuid,
# template_type,
# expected_error,
# ):
# service_one["permissions"] += [template_type]
# return mocker.patch(
# "app.service_api_client.get_service_template",
# return_value=template_json(
# SERVICE_ONE_ID,
# fake_uuid,
# type_=template_type,
# ),
# )
# page = client_request.post(
# ".edit_service_template",
# service_id=SERVICE_ONE_ID,
# template_id=fake_uuid,
# _data={
# "id": fake_uuid,
# "name": "new name",
# "template_content": "here's a burger 🍔",
# "service": SERVICE_ONE_ID,
# "template_type": template_type,
# "process_type": "normal",
# },
# _expected_status=200,
# )
# assert expected_error in page.text
# assert mock_update_service_template.called is False
@pytest.mark.parametrize(
("template_type", "expected_error"),
[
(
"sms",
(
"Please remove the unaccepted character 🍔 in your message, then save again"
),
),
],
)
def test_should_not_update_sms_template_with_emoji(
mocker,
client_request,
service_one,
mock_get_service_template,
mock_update_service_template,
fake_uuid,
template_type,
expected_error,
):
service_one["permissions"] += [template_type]
return mocker.patch(
"app.service_api_client.get_service_template",
return_value=template_json(
SERVICE_ONE_ID,
fake_uuid,
type_=template_type,
),
)
page = client_request.post(
".edit_service_template",
service_id=SERVICE_ONE_ID,
template_id=fake_uuid,
_data={
"id": fake_uuid,
"name": "new name",
"template_content": "here's a burger 🍔",
"service": SERVICE_ONE_ID,
"template_type": template_type,
"process_type": "normal",
},
_expected_status=200,
)
assert expected_error in page.text
assert mock_update_service_template.called is False
@pytest.mark.parametrize(