Beispiel #1
0
 def test_create_sick(self):
     """
     this function tests that a created sick is in the patients list
     """
     data_access = PythonDataAccess()
     person = data_access.create_patient("052222222", "firstName",
                                         "surName", 1,
                                         datetime.datetime.now(), "[email protected]",
                                         "Gaza", "Gaz", 14, 14, 102, True,
                                         datetime.datetime.now())
     list_of_patients = data_access.read_list_of_patients()
     self.assertTrue(person in list_of_patients)
Beispiel #2
0
 def test_delete_test_by_test_id_and_lab_id(self):
     data_access = PythonDataAccess()
     data_access.create_patient("052222222", "firstName", "surName", 1,
                                datetime.datetime.now(), "[email protected]", "Gaza",
                                "Gaz", 14, 14, 102, True,
                                datetime.datetime.now())
     data_access.update_test_result(3, 4, 1, datetime.datetime.now(), True)
     self.assertTrue(data_access.delete_test_by_test_id_and_lab_id(3, 4))
Beispiel #3
0
 def test_update_sick_encounter_details(self):
     data_access = PythonDataAccess()
     data_access.create_patient("052222222", "firstName", "surName", 1,
                                datetime.datetime.now(), "[email protected]", "Gaza",
                                "Gaz", 14, 14, 102, True,
                                datetime.datetime.now())
     ### initialize class counter in case other tests used Suspect class
     Suspect.class_counter = 0
     ###
     data_access.create_sick_encounter(1, "Gozal", "Rahum", "0524829321")
     updated_person = data_access.update_sick_encounter_details(
         0, 2, "first_name", "sur_name", datetime.datetime.now(), "44444",
         "[email protected]", "city", "street", 4, 3, 2)
     list_of_patients = data_access.read_list_of_patients()
     self.assertTrue(updated_person in list_of_patients)
Beispiel #4
0
 def test_delete_patient_by_id(self):
     data_access = PythonDataAccess()
     person = data_access.create_patient("052222222", "firstName",
                                         "surName", 1,
                                         datetime.datetime.now(), "[email protected]",
                                         "Gaza", "Gaz", 14, 14, 102, True,
                                         datetime.datetime.now())
     data_access.delete_patient_by_id(1)
     self.assertTrue(person not in data_access.read_list_of_patients())
Beispiel #5
0
 def test_update_test_result(self):
     data_access = PythonDataAccess()
     data_access.create_patient("052222222", "firstName", "surName", 1,
                                datetime.datetime.now(), "[email protected]", "Gaza",
                                "Gaz", 14, 14, 102, True,
                                datetime.datetime.now())
     test = data_access.update_test_result(3, 4, 1, datetime.datetime.now(),
                                           True)
     self.assertTrue(test in data_access.read_list_of_tests())
Beispiel #6
0
 def test_create_sick_in_site(self):
     data_access = PythonDataAccess()
     data_access.create_patient("052222222", "firstName", "surName", 1,
                                datetime.datetime.now(), "[email protected]", "Gaza",
                                "Gaz", 14, 14, 102, True,
                                datetime.datetime.now())
     # above is creating sick
     sick_in_site = data_access.create_sick_in_site(1, "Friend-Home",
                                                    datetime.datetime.now(),
                                                    "Gaza", "Gas", 3)
     list_of_sick_in_site = data_access.read_list_of_sick_in_site()
     self.assertTrue(sick_in_site in list_of_sick_in_site)
Beispiel #7
0
 def test_create_sick_encounter(self):
     data_access = PythonDataAccess()
     data_access.create_patient("052222222", "firstName", "surName", 1,
                                datetime.datetime.now(), "[email protected]", "Gaza",
                                "Gaz", 14, 14, 102, True,
                                datetime.datetime.now())
     ### initialize class counter in case other tests used Suspect class
     Suspect.class_counter = 0
     ###
     sick_encounter = data_access.create_sick_encounter(
         1, "Gozal", "Rahum", "0524829321")
     list_of_patients = data_access.read_list_of_patients()
     self.assertTrue(sick_encounter in list_of_patients)
Beispiel #8
0
 def test_update_test_result(self):
     data_access = PythonDataAccess()
     data_access.create_patient("052222222", "firstName", "surName", 1,
                                datetime.datetime.now(), "[email protected]", "Gaza",
                                "Gaz", 14, 14, 102, True,
                                datetime.datetime.now())
     failed_update = data_access.update_test_result(
         1, 1, 4, datetime.datetime.now(),
         True)  # with id of a non-existing person
     self.assertFalse(failed_update)
     success_update = data_access.update_test_result(
         1, 1, 1, datetime.datetime.now(),
         False)  # with id of an existing person
     self.assertTrue(success_update)
Beispiel #9
0
 def test_update_test_result_with_no_existing_person(self):
     data_access = PythonDataAccess()
     test = data_access.update_test_result(3, 4, 1, datetime.datetime.now(),
                                           True)
     self.assertFalse(test in data_access.read_list_of_tests())
Beispiel #10
0
from controller import Controller
from data_access import PythonDataAccess
from view import ViewConsole
import sys
# main
if __name__ == "__main__":
    """
    How to run from CLI: python main.py <commands_file_path>
    command file example:
        HelpTest.txt: [every line is an individual command]
            Show-help
            Create-sick 123 Foo Bar 2020-04-26 012-3456789 [email protected] NewYork MyStreet 1 2 3
            Add-route-site 123 2020-04-26 11:00 Ruppin-college
            Add-route-site 123 2020-04-26 11:30 Supermarket
            Show-new-sick
    """
    if len(sys.argv) < 2:
        exit('no commands file in argv')
    commands_file_path = sys.argv[1]
    view = ViewConsole(commands_file_path)
    container = PythonDataAccess()
    controller = Controller(view, container)
    controller.start()