Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding testing framework #11

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions tests/tst_app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import unittest
from unittest.mock import patch, MagicMock
from typing import List
from dotlas import App

class TestApp(unittest.TestCase): # Replace App with the actual class name

@classmethod
def setUpClass(cls):
cls.app = App("xyz") # Replace App with the actual class name

@patch.object(App, "_App__generic_fetch") # Replace App with the actual class name
def test_list_commercial_types(self, mock_fetch):
mock_fetch.return_value = ['retail', 'restaurants', 'gyms']
result = self.app.list_commercial_types()
self.assertEqual(result, ['retail', 'restaurants', 'gyms'])

@patch.object(App, "_App__generic_fetch") # Replace App with the actual class name
def test_list_cities(self, mock_fetch):
mock_fetch.return_value = ['Los Angeles', 'New York', 'Chicago']
result = self.app.list_cities()
self.assertEqual(result, ['Los Angeles', 'New York', 'Chicago'])

@patch.object(App, "_App__generic_fetch") # Replace App with the actual class name
def test_list_places_in_city(self, mock_fetch):
mock_fetch.return_value = ['Burbank', 'Beverly Hills']
result = self.app.list_places_in_city('Los Angeles')
self.assertEqual(result, ['Burbank', 'Beverly Hills'])

@patch.object(App, "_App__generic_fetch") # Replace App with the actual class name
def test_list_areas_in_city(self, mock_fetch):
mock_fetch.return_value = ['Financial District', 'Upper West Side']
result = self.app.list_areas_in_city('New York')
self.assertEqual(result, ['Financial District', 'Upper West Side'])

if __name__ == '__main__':
unittest.main()