(
self, mock_save, mock_refresh, mock_validate, mock_load
)
| 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) |
nothing calls this directly
no outgoing calls
no test coverage detected