From 9e61e36b7f49d62f35196ff98269d0bd855e88db Mon Sep 17 00:00:00 2001 From: Kai Date: Sun, 3 Apr 2022 14:17:56 +0200 Subject: [PATCH] Try to fix the Oauth-tests reproducibility --- tests/test_settings.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tests/test_settings.py b/tests/test_settings.py index b3f14aa..a518f29 100644 --- a/tests/test_settings.py +++ b/tests/test_settings.py @@ -20,9 +20,18 @@ def test_settings_public(rocket): def test_settings_oauth(logged_rocket): + # refresh is not done with any API call ever, so we need to call it manually here + logged_rocket.call_api_post("method.call/refreshOAuthService", + message='{"method": "refreshOAuthService", "params": []}') oauth_get = logged_rocket.settings_oauth().json() assert oauth_get.get("success") - assert not oauth_get.get("services") + if oauth_get.get("services"): + # remove the OAuth app Test beforehand, when this is not the first test run (for reproducibility) + logged_rocket.call_api_post("method.call/removeOAuthService", + message='{"method": "removeOAuthService", "params": ["Test"]}') + oauth_get = logged_rocket.settings_oauth().json() + assert not oauth_get.get("services") + oauth_set = logged_rocket.settings_addcustomoauth("Test").json() assert oauth_set.get("success") oauth_set = logged_rocket.settings_update("Accounts_OAuth_Custom-Test", True).json()