From 28cf49c8ac24ede2ea79076f3ce4a91c07acf6e5 Mon Sep 17 00:00:00 2001
From: "Antoine R. Dumont (@ardumont)" <antoine.romain.dumont@gmail.com>
Date: Wed, 3 Mar 2021 15:32:54 +0100
Subject: [PATCH] swh.auth: Add coverage to logout endpoint

Related to T3079
---
 swh/auth/tests/conftest.py  | 1 +
 swh/auth/tests/test_auth.py | 6 ++++++
 2 files changed, 7 insertions(+)

diff --git a/swh/auth/tests/conftest.py b/swh/auth/tests/conftest.py
index a89e3eb..2a622cd 100644
--- a/swh/auth/tests/conftest.py
+++ b/swh/auth/tests/conftest.py
@@ -25,6 +25,7 @@ def mock_keycloak(requests_mock):
     requests_mock.get(WELL_KNOWN["well-known"], json=WELL_KNOWN)
     requests_mock.post(WELL_KNOWN["token_endpoint"], json=OIDC_PROFILE)
     requests_mock.get(WELL_KNOWN["userinfo_endpoint"], json=USER_INFO)
+    requests_mock.post(WELL_KNOWN["end_session_endpoint"], status_code=204)
 
     return requests_mock
 
diff --git a/swh/auth/tests/test_auth.py b/swh/auth/tests/test_auth.py
index 673b515..54d56d9 100644
--- a/swh/auth/tests/test_auth.py
+++ b/swh/auth/tests/test_auth.py
@@ -75,3 +75,9 @@ def test_auth_userinfo(mock_keycloak, keycloak_open_id_connect):
     assert actual_user_info == USER_INFO
 
     assert mock_keycloak.called
+
+
+def test_auth_logout(mock_keycloak, keycloak_open_id_connect):
+    keycloak_open_id_connect.logout("refresh-token")
+
+    assert mock_keycloak.called
-- 
GitLab