def load_creds(profile: Optional[str] = None) -> ReadOnlyCredentials: session = mk_boto_session(profile=profile) creds = get_creds_with_retry(session) if creds is None: raise ValueError("Failed to obtain credentials") return creds.get_frozen_credentials()
def test_creds_with_retry(): session = mock.MagicMock() session.get_credentials = mock.MagicMock(return_value=None) assert get_creds_with_retry(session, 2, 0.01) is None assert session.get_credentials.call_count == 2