Updpdate
DevPlace CI / test (push) Failing after 7m3s

This commit is contained in:
2026-07-23 00:02:43 +02:00
parent 34fa56a836
commit 64c3983c9f
37 changed files with 2105 additions and 824 deletions
+39
View File
@@ -1,9 +1,11 @@
# retoor <retoor@molodetz.nl>
import io
import time
from datetime import datetime, timezone
import pytest
import requests
from PIL import Image
from tests.conftest import BASE_URL
from devplacepy.database import get_table, refresh_snapshot, set_setting
from devplacepy.utils import generate_uid, make_combined_slug
@@ -127,3 +129,40 @@ def test_message_send_recorded(seeded_db):
).json()["data"]
admin = _admin(seeded_db)
assert _find(admin, "message.send", lambda e: e.get("target_uid") == msg["uid"]) is not None
def _png_bytes():
buf = io.BytesIO()
Image.new("RGB", (4, 4), (0, 128, 255)).save(buf, "PNG")
return buf.getvalue()
def _upload(session, name="attach.png"):
r = session.post(
f"{BASE_URL}/uploads/upload", files={"file": (name, _png_bytes(), "image/png")}
)
assert r.status_code == 201, r.text
return r.json()["uid"]
def test_send_attachment_only_empty_content_succeeds(seeded_db):
s, _ = _member()
receiver = _db_user("bob_test")["uid"]
attachment_uid = _upload(s)
r = s.post(
f"{BASE_URL}/messages/send",
headers=JSON_audit_log,
data={
"content": "",
"receiver_uid": receiver,
"attachment_uids": attachment_uid,
},
)
assert r.status_code == 200, r.text[:300]
msg = r.json()["data"]
assert msg["uid"]
refresh_snapshot()
row = get_table("messages").find_one(uid=msg["uid"])
assert row["content"] == ""