From ecea4bb0573a30f50a415fb6dee77eeb2967ecb3 Mon Sep 17 00:00:00 2001
From: Adam Williamson <awilliam@redhat.com>
Date: May 18 2024 01:49:06 +0000
Subject: Update URL for image download test


Signed-off-by: Adam Williamson <awilliam@redhat.com>

---

diff --git a/tests/fixtures/cassettes/test_download_image.yaml b/tests/fixtures/cassettes/test_download_image.yaml
index ec7885b..8c8a723 100644
--- a/tests/fixtures/cassettes/test_download_image.yaml
+++ b/tests/fixtures/cassettes/test_download_image.yaml
@@ -11,23 +11,46 @@ interactions:
       User-Agent:
       - python-requests/2.31.0
     method: GET
-    uri: http://localhost:5001/test.img.xz
+    uri: https://pagure.io/cloud-image-uploader/blob/main/f/tests/fixtures/http/test.img.xz
   response:
     body:
       string: !!binary |
         /Td6WFoAAATm1rRGAgAhARYAAAB0L+WjAQAadGhpcyBpc24ndCByZWFsbHkgYW4gaW1hZ2UKAAAa
         UXdAW5qqSgABMxv3GYheH7bzfQEAAAAABFla
     headers:
+      Connection:
+      - Upgrade, Keep-Alive
       Content-Length:
       - '84'
-      Content-type:
-      - application/x-xz
+      Content-Security-Policy:
+      - default-src 'self';script-src 'self' 'nonce-DMilabatMzxQdMogZXtdNW08s'; style-src
+        'self' 'nonce-DMilabatMzxQdMogZXtdNW08s'; object-src 'none';base-uri 'self';img-src
+        'self' https:;connect-src 'self' https://pagure.io:8088;frame-src https://docs.pagure.org;frame-ancestors
+        https://pagure.io;
+      Content-Type:
+      - application/octet-stream; charset=xz
       Date:
-      - Thu, 16 May 2024 19:37:30 GMT
-      Last-Modified:
-      - Wed, 15 May 2024 23:31:34 GMT
+      - Sat, 18 May 2024 01:48:57 GMT
+      Keep-Alive:
+      - timeout=5, max=100
+      Referrer-Policy:
+      - same-origin
       Server:
-      - SimpleHTTP/0.6 Python/3.12.3
+      - Apache/2.4.37 (Red Hat Enterprise Linux) OpenSSL/1.1.1k mod_wsgi/4.6.4 Python/3.6
+      Set-Cookie:
+      - pagure=eyJfcGVybWFuZW50Ijp0cnVlLCJjc3JmX3Rva2VuIjoiZGJkNzdiYmI5OWRhOGNmNWZjODBmMTcwOTljNWY1MzM4YWI0MTUxZCJ9.GSmaiQ.9eEHxektWtA-QHw_x-PbUfkuQCs;
+        Expires=Tue, 18-Jun-2024 01:48:57 GMT; Secure; HttpOnly; Path=/
+      Strict-Transport-Security:
+      - max-age=31536000; includeSubDomains; preload
+      Upgrade:
+      - h2,h2c
+      X-Content-Type-Options:
+      - nosniff
+      - nosniff
+      X-Frame-Options:
+      - ALLOW-FROM https://pagure.io/
+      X-Xss-Protection:
+      - 1; mode=block
     status:
       code: 200
       message: OK
@@ -40,26 +63,49 @@ interactions:
       - gzip, deflate, br
       Connection:
       - keep-alive
+      Cookie:
+      - pagure=eyJfcGVybWFuZW50Ijp0cnVlLCJjc3JmX3Rva2VuIjoiZGJkNzdiYmI5OWRhOGNmNWZjODBmMTcwOTljNWY1MzM4YWI0MTUxZCJ9.GSmaiQ.9eEHxektWtA-QHw_x-PbUfkuQCs
       User-Agent:
       - python-requests/2.31.0
     method: GET
-    uri: http://localhost:5001/test.img.xz
+    uri: https://pagure.io/cloud-image-uploader/blob/main/f/tests/fixtures/http/test.img.xz
   response:
     body:
       string: !!binary |
         /Td6WFoAAATm1rRGAgAhARYAAAB0L+WjAQAadGhpcyBpc24ndCByZWFsbHkgYW4gaW1hZ2UKAAAa
         UXdAW5qqSgABMxv3GYheH7bzfQEAAAAABFla
     headers:
+      Connection:
+      - Keep-Alive
       Content-Length:
       - '84'
-      Content-type:
-      - application/x-xz
+      Content-Security-Policy:
+      - default-src 'self';script-src 'self' 'nonce-nFIhf9WqFZ3l9OZk5ZiARlMZf'; style-src
+        'self' 'nonce-nFIhf9WqFZ3l9OZk5ZiARlMZf'; object-src 'none';base-uri 'self';img-src
+        'self' https:;connect-src 'self' https://pagure.io:8088;frame-src https://docs.pagure.org;frame-ancestors
+        https://pagure.io;
+      Content-Type:
+      - application/octet-stream; charset=xz
       Date:
-      - Thu, 16 May 2024 19:37:30 GMT
-      Last-Modified:
-      - Wed, 15 May 2024 23:31:34 GMT
+      - Sat, 18 May 2024 01:48:57 GMT
+      Keep-Alive:
+      - timeout=5, max=99
+      Referrer-Policy:
+      - same-origin
       Server:
-      - SimpleHTTP/0.6 Python/3.12.3
+      - Apache/2.4.37 (Red Hat Enterprise Linux) OpenSSL/1.1.1k mod_wsgi/4.6.4 Python/3.6
+      Set-Cookie:
+      - pagure=eyJfcGVybWFuZW50Ijp0cnVlLCJjc3JmX3Rva2VuIjoiZGJkNzdiYmI5OWRhOGNmNWZjODBmMTcwOTljNWY1MzM4YWI0MTUxZCJ9.GSmaiQ.9eEHxektWtA-QHw_x-PbUfkuQCs;
+        Expires=Tue, 18-Jun-2024 01:48:57 GMT; Secure; HttpOnly; Path=/
+      Strict-Transport-Security:
+      - max-age=31536000; includeSubDomains; preload
+      X-Content-Type-Options:
+      - nosniff
+      - nosniff
+      X-Frame-Options:
+      - ALLOW-FROM https://pagure.io/
+      X-Xss-Protection:
+      - 1; mode=block
     status:
       code: 200
       message: OK
@@ -72,31 +118,89 @@ interactions:
       - gzip, deflate, br
       Connection:
       - keep-alive
+      Cookie:
+      - pagure=eyJfcGVybWFuZW50Ijp0cnVlLCJjc3JmX3Rva2VuIjoiZGJkNzdiYmI5OWRhOGNmNWZjODBmMTcwOTljNWY1MzM4YWI0MTUxZCJ9.GSmaiQ.9eEHxektWtA-QHw_x-PbUfkuQCs
       User-Agent:
       - python-requests/2.31.0
     method: GET
-    uri: http://localhost:5001/notfound
+    uri: https://pagure.io/notthere/notfound
   response:
     body:
-      string: "<!DOCTYPE HTML>\n<html lang=\"en\">\n    <head>\n        <meta charset=\"utf-8\">\n
-        \       <title>Error response</title>\n    </head>\n    <body>\n        <h1>Error
-        response</h1>\n        <p>Error code: 404</p>\n        <p>Message: File not
-        found.</p>\n        <p>Error code explanation: 404 - Nothing matches the given
-        URI.</p>\n    </body>\n</html>\n"
+      string: "\n<!DOCTYPE html>\n<html lang='en'>\n<head>\n    <meta http-equiv=\"Content-Type\"
+        content=\"text/html; charset=UTF-8\"/>\n    <title>Page not found :'( - Pagure.io</title>\n
+        \       <link rel=\"shortcut icon\" type=\"image/vnd.microsoft.icon\"\n        href=\"/theme/static/favicon.ico?version=5.13.3\"/>\n
+        \   <link href=\"/theme/static/fedora-bootstrap-1.3.0/fedora-bootstrap.min.css?version=5.13.3\"\n
+        \       type=\"text/css\" rel=\"stylesheet\" />\n    <link href=\"/theme/static/fonts/fonts.css?version=5.13.3\"\n
+        \       rel=\"stylesheet\" type=\"text/css\" />\n    <link href=\"/theme/static/fonts/hack_fonts/css/hack-extended.min.css?version=5.13.3\"\n
+        \       type=\"text/css\" rel=\"stylesheet\" />\n    <link href=\"/theme/static/theme.css?version=5.13.3\"\n
+        \       type=\"text/css\" rel=\"stylesheet\" />\n\n    <link type=\"text/css\"
+        rel=\"stylesheet\" nonce=\"UJHYDiN4TzFjkkr231WHLOH4G\" href=\"/static/vendor/font-awesome/font-awesome.css?version=5.13.3\"/>\n
+        \   <link type=\"text/css\" rel=\"stylesheet\" nonce=\"UJHYDiN4TzFjkkr231WHLOH4G\"
+        href=\"/static/pagure.css?version=5.13.3\"/>\n  </head>\n  <body id=\"error\">\n
+        \   \n    <!-- start masthead -->\n    <nav class=\"navbar navbar-light masthead
+        p-0 navbar-expand\">\n      <div class=\"container\">\n        <a href=\"/\"
+        class=\"navbar-brand\">\n        <img height=\"40\" src=\"/theme/static/pagure-logo.png?version=5.13.3\"\n
+        \            alt=\"pagure Logo\" id=\"pagureLogo\"/>\n        </a>\n        <ul
+        class=\"navbar-nav ml-auto\">\n\n          \n\n          <li class=\"nav-item\">\n
+        \           <a class=\"btn btn-primary\" href=\"/login/?next=https://pagure.io/notthere/notfound\">Log
+        In</a>\n          </li>\n        </ul>\n      </div>\n    </nav>\n    <!--
+        close masthead-->\n\n    <div class=\"bodycontent\">\n\n\n<div class=\"container
+        p-t-3\">\n  <div class=\"row\">\n    <div class=\"col-md-8\">\n      <h2>Page
+        not found (404)</h2>\n      <p>With the message:</p>\n      <div class=\"card-block\">\n
+        \     <p>Project not found</p>\n      </div>\n      <p>You have either entered
+        a bad URL or the page has moved, removed, or otherwise rendered unavailable.<br/>\n
+        \     Please use the main navigation menu to get (re)started.</p>\n    </div>\n
+        \ </div>\n</div>\n    </div>\n\n        <div class=\"footer pt-4 text-white\">\n
+        \       <div class=\"container\">\n            <div class=\"d-flex align-items-center\">\n
+        \               <div>\n                    <div>Powered by <a href=\"https://pagure.io/pagure\"
+        class=\"notblue\">Pagure</a> 5.13.3</div>\n                    <div>\n                        <a
+        href=\"https://docs.pagure.org/pagure/usage/index.html\" class=\"notblue\">Documentation</a>
+        &bull;\n                        <a href=\"https://pagure.io/pagure/new_issue\"
+        class=\"notblue\">File an Issue</a> &bull;\n                        <a href=\"/about\">About</a>
+        &bull;\n                        <a href=\"/ssh_info\" class=\"notblue\">SSH
+        Hostkey/Fingerprint</a>\n                    </div>\n                </div>\n
+        \               <div class=\"ml-auto text-right\">\n                    <div>&copy;
+        Red Hat, Inc. and others.</div>\n                </div>\n            </div>\n
+        \       </div>\n    </div>\n\n\n    <script type=\"text/javascript\" nonce=\"UJHYDiN4TzFjkkr231WHLOH4G\"
+        src=\"/static/vendor/jquery/jquery.min.js?version=5.13.3\"></script>\n\n    <script
+        src=\"/static/vendor/bootstrap/bootstrap.bundle.min.js?version=5.13.3\"></script>\n\n
+        \   <script type=\"text/javascript\" nonce=\"UJHYDiN4TzFjkkr231WHLOH4G\">\n
+        \     $('[data-toggle=\"tooltip\"]').tooltip({placement : 'bottom'});\n      $(\".cancel_btn\").click(function()
+        {\n        history.back();\n      });\n    </script>\n\n</body>\n</html>"
     headers:
       Connection:
-      - close
+      - Keep-Alive
       Content-Length:
-      - '335'
+      - '3488'
+      Content-Security-Policy:
+      - default-src 'self';script-src 'self' 'nonce-UJHYDiN4TzFjkkr231WHLOH4G'; style-src
+        'self' 'nonce-UJHYDiN4TzFjkkr231WHLOH4G'; object-src 'none';base-uri 'self';img-src
+        'self' https:;connect-src 'self' https://pagure.io:8088;frame-src https://docs.pagure.org;frame-ancestors
+        https://pagure.io;
       Content-Type:
-      - text/html;charset=utf-8
+      - text/html; charset=utf-8
       Date:
-      - Thu, 16 May 2024 19:37:30 GMT
+      - Sat, 18 May 2024 01:48:57 GMT
+      Keep-Alive:
+      - timeout=5, max=98
+      Referrer-Policy:
+      - same-origin
       Server:
-      - SimpleHTTP/0.6 Python/3.12.3
+      - Apache/2.4.37 (Red Hat Enterprise Linux) OpenSSL/1.1.1k mod_wsgi/4.6.4 Python/3.6
+      Set-Cookie:
+      - pagure=eyJfcGVybWFuZW50Ijp0cnVlLCJjc3JmX3Rva2VuIjoiZGJkNzdiYmI5OWRhOGNmNWZjODBmMTcwOTljNWY1MzM4YWI0MTUxZCJ9.GSmaiQ.9eEHxektWtA-QHw_x-PbUfkuQCs;
+        Expires=Tue, 18-Jun-2024 01:48:57 GMT; Secure; HttpOnly; Path=/
+      Strict-Transport-Security:
+      - max-age=31536000; includeSubDomains; preload
+      X-Content-Type-Options:
+      - nosniff
+      X-Frame-Options:
+      - ALLOW-FROM https://pagure.io/
+      X-Xss-Protection:
+      - 1; mode=block
     status:
       code: 404
-      message: File not found
+      message: NOT FOUND
 - request:
     body: null
     headers:
@@ -106,26 +210,51 @@ interactions:
       - gzip, deflate, br
       Connection:
       - keep-alive
+      Cookie:
+      - pagure=eyJfcGVybWFuZW50Ijp0cnVlLCJjc3JmX3Rva2VuIjoiZGJkNzdiYmI5OWRhOGNmNWZjODBmMTcwOTljNWY1MzM4YWI0MTUxZCJ9.GSmaiQ.9eEHxektWtA-QHw_x-PbUfkuQCs
       User-Agent:
       - python-requests/2.31.0
     method: GET
-    uri: http://localhost:5001/test.img.xz
+    uri: https://pagure.io/cloud-image-uploader/blob/main/f/tests/fixtures/http/test.img.xz
   response:
     body:
       string: !!binary |
         /Td6WFoAAATm1rRGAgAhARYAAAB0L+WjAQAadGhpcyBpc24ndCByZWFsbHkgYW4gaW1hZ2UKAAAa
         UXdAW5qqSgABMxv3GYheH7bzfQEAAAAABFla
     headers:
+      Connection:
+      - Upgrade, Keep-Alive
       Content-Length:
       - '84'
-      Content-type:
-      - application/x-xz
+      Content-Security-Policy:
+      - default-src 'self';script-src 'self' 'nonce-HhRYgnlDIgui8Q4euiXLwUZWG'; style-src
+        'self' 'nonce-HhRYgnlDIgui8Q4euiXLwUZWG'; object-src 'none';base-uri 'self';img-src
+        'self' https:;connect-src 'self' https://pagure.io:8088;frame-src https://docs.pagure.org;frame-ancestors
+        https://pagure.io;
+      Content-Type:
+      - application/octet-stream; charset=xz
       Date:
-      - Thu, 16 May 2024 19:37:30 GMT
-      Last-Modified:
-      - Wed, 15 May 2024 23:31:34 GMT
+      - Sat, 18 May 2024 01:48:57 GMT
+      Keep-Alive:
+      - timeout=5, max=100
+      Referrer-Policy:
+      - same-origin
       Server:
-      - SimpleHTTP/0.6 Python/3.12.3
+      - Apache/2.4.37 (Red Hat Enterprise Linux) OpenSSL/1.1.1k mod_wsgi/4.6.4 Python/3.6
+      Set-Cookie:
+      - pagure=eyJfcGVybWFuZW50Ijp0cnVlLCJjc3JmX3Rva2VuIjoiZGJkNzdiYmI5OWRhOGNmNWZjODBmMTcwOTljNWY1MzM4YWI0MTUxZCJ9.GSmaiQ.9eEHxektWtA-QHw_x-PbUfkuQCs;
+        Expires=Tue, 18-Jun-2024 01:48:57 GMT; Secure; HttpOnly; Path=/
+      Strict-Transport-Security:
+      - max-age=31536000; includeSubDomains; preload
+      Upgrade:
+      - h2,h2c
+      X-Content-Type-Options:
+      - nosniff
+      - nosniff
+      X-Frame-Options:
+      - ALLOW-FROM https://pagure.io/
+      X-Xss-Protection:
+      - 1; mode=block
     status:
       code: 200
       message: OK
diff --git a/tests/test_handler.py b/tests/test_handler.py
index 9a47e80..9c76547 100644
--- a/tests/test_handler.py
+++ b/tests/test_handler.py
@@ -200,7 +200,7 @@ def test_consumer_handle_exceptions(mock_getrel, mock_relinfo, mock_sleep, fixtu
 def test_download_image():
     """Test download_image functionality."""
     image = {
-        "url": "http://localhost:5001/test.img.xz",
+        "url": "https://pagure.io/cloud-image-uploader/blob/main/f/tests/fixtures/http/test.img.xz",
         "path": "/path/to/test.img.xz",
         "checksums": {
             "sha256": "eba53879a0b19322b900691641e33ed4e6cb34095c8bc722f6b8d5b65a22d1d3",
@@ -220,7 +220,7 @@ def test_download_image():
                 ret = consumer.download_image(image, tempdir, decompress=True)
         # and on bad URL
         origurl = image["url"]
-        image["url"] = "http://localhost:5001/notfound"
+        image["url"] = "https://pagure.io/notthere/notfound"
         with pytest.raises(exceptions.Nack):
             ret = consumer.download_image(image, tempdir, decompress=True)
         # and on bad checksum

