File size: 1,019 Bytes
53a6315
5dc04ad
53a6315
 
 
 
 
 
5dc04ad
 
 
53a6315
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import unittest
from unittest.mock import MagicMock, create_autospec
from data_service import DataService
from llm_service import LLMService
from g34_final_project import App

class TestApp(unittest.TestCase):
  def test_app(self):
    mock_tmp = MagicMock()
    mock_tmp.return_value.__enter__.return_value = create_autospec(DataService)
    with mock_tmp() as data_service, LLMService().with_key("").build() as llm_service:
      data_service.get_patients = MagicMock(return_value=["kareem", "abdul", "jabbar"])

      llm_service.get_summary = MagicMock(return_value="This is a summary")
      llm_service.answer_query = MagicMock(return_value="This is the query answer")
      llm_service.close = MagicMock(return_value=None)
      app = App(data_service, llm_service)
      app.launch()
      # TODO: This is probably not a good way to test. Maybe there isn't one for this. I just wanted to put a stub here. But it would be nice to be able to test things like "it accessed the data service get_patients once", etc.