MCPcopy Create free account
hub / github.com/mlco2/codecarbon / test_get_access_token_refresh

Method test_get_access_token_refresh

tests/cli/test_cli_auth.py:194–201  ·  view source on GitHub ↗
(
        self, mock_save, mock_refresh, mock_validate, mock_load
    )

Source from the content-addressed store, hash-verified

192 @patch("codecarbon.cli.auth._refresh_tokens")
193 @patch("codecarbon.cli.auth._save_credentials")
194 def test_get_access_token_refresh(
195 self, mock_save, mock_refresh, mock_validate, mock_load
196 ):
197 mock_load.return_value = {"access_token": "a", "refresh_token": "r"}
198 mock_validate.return_value = False
199 mock_refresh.return_value = {"access_token": "b", "refresh_token": "r"}
200 self.assertEqual(auth.get_access_token(), "b")
201 mock_save.assert_called()
202
203 @patch("codecarbon.cli.auth._refresh_tokens", side_effect=Exception("expired"))
204 @patch("codecarbon.cli.auth._validate_access_token", return_value=False)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected