@@ -255,32 +255,3 @@ def test_get_history(monkeypatch, capsys):
255255 {"role" : "user" , "content" : "Hello, world!" , "model" : "mock-model" },
256256 {"role" : "assistant" , "content" : "I am a mock model!" , "model" : "mock-model" },
257257 ]
258-
259-
260- def test_authenticate_method (monkeypatch ):
261- # Mock the login.Auth class
262- mock_auth = MagicMock ()
263- mock_auth .api_key = "test-api-key"
264- mock_auth .user_id = "test-user-id"
265-
266- def mock_auth_constructor ():
267- return mock_auth
268-
269- monkeypatch .setattr ("litai.client.login.Auth" , mock_auth_constructor )
270-
271- # Test case 1: Both api_key and user_id provided
272- LLM (model = "openai/gpt-4" , lightning_api_key = "my-key" , lightning_user_id = "my-user-id" )
273-
274- # Verify that the authentication was called
275- mock_auth .authenticate .assert_called_once ()
276-
277- # Verify that environment variables were set
278- assert os .getenv ("LIGHTNING_API_KEY" ) == "test-api-key"
279- assert os .getenv ("LIGHTNING_USER_ID" ) == "test-user-id"
280-
281- # Test case 2: Neither api_key nor user_id provided
282- mock_auth .reset_mock ()
283- LLM (model = "openai/gpt-4" )
284-
285- # Verify that authentication was not called
286- mock_auth .authenticate .assert_not_called ()
0 commit comments