File size: 851 Bytes
53a6315
5dc04ad
53a6315
 
 
7836133
53a6315
 
 
7836133
 
 
 
 
 
 
53a6315
7836133
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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
import os

class TestApp(unittest.TestCase):
  def test_app(self):
    """
    A simple test method to allow launching of the application with mock objects
    rather than the actual implementations. Used for testing the UI.
    """
    mock_data_service = DataService().build
    with mock_data_service() as data_service:
      with LLMService().with_key(os.getenv("OPENAI_API_KEY")).with_data_service(data_service).build() as llm_service:

        # Replacing the call to get_summary with a mock since this isn't implemented yet.
        llm_service.get_summary = MagicMock(return_value="This is a summary")
        app = App(data_service, llm_service)
        app.launch()