Update tests/test_utils_elog.py
Run CI Tests / test (push) Successful in 1m45s

This commit is contained in:
2025-08-12 15:24:52 +02:00
parent e1d4805679
commit 43c8c279f3
+7 -26
View File
@@ -27,26 +27,6 @@ def get_default_elog_password(url, **kwargs):
kwargs["password"] = pw
return kwargs["password"]
def test_post_local():
logbook = elog.open(
hostname="http://localhost",
port=8080,
user="robot",
password="testpassword",
use_ssl=False,
logbook="demo"
)
attributes = {
"Author": "robot",
"Subject": "Test simple",
"Category": "General",
}
message = "Hello from local test"
msg_id = logbook.post(message, attributes=attributes, encoding="HTML")
print("Posted with msg_id =", msg_id)
# Connexion basique avec credentials connus
def get_test_elog():
return Elog("http://localhost:8080/demo", user="robot", password="testpassword")
@@ -123,7 +103,7 @@ def test_post():
url = "http://localhost:8080/demo"
response = requests.get(url)
html_content = response.content.decode('utf-8')
html = response.content.decode('utf-8')
assert text in html, "Message not found"
assert author in html, f"Author not found"
@@ -141,14 +121,15 @@ def test_screenshot(mock_screenshot_class):
elog = get_test_elog()
test_msg = "SCREENSHOT_INTEGRATION_TEST_MSG_456"
entry_id = elog.screenshot(message=test_msg)
elog.screenshot(message=test_msg)
assert entry_id is not None
url = f"http://localhost:8080/demo/{entry_id}"
html = requests.get(url).text
url = f"http://localhost:8080/demo"
response = requests.get(url)
html = response.content.decode('utf-8')
filename = os.path.basename(fake_path)
assert test_msg in html, "Message not found"
assert filename in html, f"Attachment '{filename}' not found in post HTML"
os.remove(fake_path)