From 32eae01bda0a155b046c9001a324565c4ac2fc7f Mon Sep 17 00:00:00 2001
From: Clark Boylan <clark.boylan@gmail.com>
Date: Tue, 26 Nov 2024 09:20:31 -0800
Subject: [PATCH] Capture lodgeit captchas for verification purposes

This will help us verify the captchas render properly. This has been an
issue with the image library changing APIs.

Depends-On: https://review.opendev.org/c/opendev/lodgeit/+/935712/
Change-Id: I847bbb23776e89b8a74bfd25e6e790cbdae4eda6
---
 testinfra/test_paste.py | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/testinfra/test_paste.py b/testinfra/test_paste.py
index 2e175feb91..b46e1446da 100644
--- a/testinfra/test_paste.py
+++ b/testinfra/test_paste.py
@@ -59,3 +59,11 @@ def test_paste_screenshots(host):
     )
 
     take_screenshots(host, shots)
+
+    # Selenium doesn't handle screenshots of pngs, but that is fine we can
+    # just download and save the png directly into the screenshots dir.
+    # We disable ssl verification because we're connecting via bridge and
+    # it doesn't trust the cert.
+    r = requests.get('https://paste99.opendev.org/_captcha.png', verify=False)
+    with open('/var/log/screenshots/paste-captcha.png', 'wb') as f:
+        f.write(r.content)