11import getpass
22import os
33from datetime import datetime , timedelta , timezone
4- from unittest .mock import patch
4+ from unittest .mock import ANY , patch
55
66import keyring
77import pytest
@@ -183,8 +183,6 @@ def test_get_refresh_token_when_error_raised(
183183
184184 @freeze_time ("2024-06-01 10:00:00" )
185185 def test_store_sso_tokens (self , mock_get_user , mock_set_password ):
186- refresh_attempted_at = datetime .utcnow ().isoformat ()
187-
188186 # Ensure keyring is enabled
189187 env = os .environ .copy ()
190188 env .pop ("CLOUDSMITH_NO_KEYRING" , None )
@@ -201,7 +199,7 @@ def test_store_sso_tokens(self, mock_get_user, mock_set_password):
201199 mock_set_password .assert_any_call (
202200 "cloudsmith_cli-access_token_refresh_attempted_at-https://example.com" ,
203201 "test_user" ,
204- refresh_attempted_at ,
202+ ANY ,
205203 )
206204 mock_set_password .assert_any_call (
207205 "cloudsmith_cli-refresh_token-https://example.com" ,
@@ -243,10 +241,3 @@ def test_returns_true_when_env_var_is_falsy(self, env_value):
243241 """When CLOUDSMITH_NO_KEYRING is set to a falsy value, keyring should be used."""
244242 with patch .dict (os .environ , {"CLOUDSMITH_NO_KEYRING" : env_value }):
245243 assert should_use_keyring () is True
246-
247- def test_returns_true_when_env_var_not_set (self ):
248- """When CLOUDSMITH_NO_KEYRING is not set at all, keyring should be used."""
249- env = os .environ .copy ()
250- env .pop ("CLOUDSMITH_NO_KEYRING" , None )
251- with patch .dict (os .environ , env , clear = True ):
252- assert should_use_keyring () is True
0 commit comments