From 8d3c2bc9dc4771bedaefe393a95b7d2f5da43c4e Mon Sep 17 00:00:00 2001
From: Antoine Lambert <anlambert@softwareheritage.org>
Date: Mon, 26 Jun 2023 13:42:42 +0200
Subject: [PATCH] test_backend: Fix sentry DSN format

Latest sentry-sdk release now raises a BadDsn exception when
DSN format does not match the expected one.
---
 swh/vault/tests/test_backend.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/swh/vault/tests/test_backend.py b/swh/vault/tests/test_backend.py
index 87bce1d..f4fba67 100644
--- a/swh/vault/tests/test_backend.py
+++ b/swh/vault/tests/test_backend.py
@@ -19,6 +19,8 @@ from swh.model.swhids import CoreSWHID
 from swh.vault.exc import NotFoundExc
 from swh.vault.tests.vault_testing import hash_content
 
+SENTRY_DSN = "https://user@example.org/1234"
+
 
 @contextlib.contextmanager
 def mock_cooking(vault_backend):
@@ -244,7 +246,7 @@ def test_send_all_emails(swh_vault):
 
 def test_send_email_error_no_smtp(swh_vault):
     reports = []
-    init_sentry("http://example.org", extra_kwargs={"transport": reports.append})
+    init_sentry(SENTRY_DSN, extra_kwargs={"transport": reports.append})
 
     emails = ("a@example.com", "billg@example.com", "test+42@example.org")
     with mock_cooking(swh_vault):
@@ -270,7 +272,7 @@ def test_send_email_error_no_smtp(swh_vault):
 
 def test_send_email_error_send_failed(swh_vault):
     reports = []
-    init_sentry("http://example.org", extra_kwargs={"transport": reports.append})
+    init_sentry(SENTRY_DSN, extra_kwargs={"transport": reports.append})
 
     emails = ("a@example.com", "billg@example.com", "test+42@example.org")
     with mock_cooking(swh_vault):
-- 
GitLab