示例#1
0
 def test_print_invalid_person_identifier(self):
     main.add_person("erika", "dike", "staff")
     test_output = ("No identifier was found for the name supplied\n")
     with capture(main.print_person_id, "ina", "dike") as app_output:
         self.assertEqual(
             test_output, app_output,
             msg=("{0} != {1}").format(test_output, app_output)
         )
示例#2
0
 def test_print_allocations_when_there_are_no_allocations(self):
     test_output = ("There are no allocations in memory. You can either "
                    "enter new data or load data from database\n")
     with capture(main.print_allocations, "screen") as app_output:
         self.assertEqual(
             test_output, app_output,
             msg=("- {0} != {1}!!!".format(test_output, app_output))
         )
示例#3
0
 def test_print_unallocated(self):
     main.add_person("erika", "dike", "fellow", "Y")
     test_output = ("LIST OF ALL UNALLOCATED PEOPLE\n\n"
                    "ERIKA DIKE\n\n")
     with capture(main.print_unallocated, "screen") as app_output:
         self.assertEqual(
             test_output, app_output,
             msg=("{0} != {1}!!!".format(test_output, app_output))
         )
示例#4
0
 def test_print_allocations_when_there_are_allocations(self):
     self.add_data_to_memory_for_print_allocation_tests()
     test_output = self.prepare_test_output()
     test_output += "\n"
     with capture(main.print_allocations, "screen") as app_output:
         self.assertEqual(
             test_output, app_output,
             msg=("{0} != {1}!!!".format(test_output, app_output))
         )
示例#5
0
    def test_print_unallocated_invalid_file(self):
        main.add_person("erika", "dike", "fellow", "Y")
        test_output = ("You must enter a file name with a .txt extension to "
                       "save to file\n")

        with capture(main.print_unallocated, "unalloc.pkl") as app_output:
            self.assertEqual(
                test_output, app_output,
                msg=("{0} != {1}".format(test_output, app_output))
            )
示例#6
0
 def test_print_person_identifier(self):
     main.create_room("bellows", 0, "office")
     main.add_person("erika", "dike", "staff")
     test_output = ("ERIKA DIKE's identifier: 0\n")
     with capture(main.print_person_id, "erika", "dike") as app_output:
         self.assertEqual(
             test_output, app_output,
             msg=("get_person_identifier does not print as expected!!! "
                  "{0} != {1}").format(test_output, app_output)
         )
示例#7
0
 def test_print_room_with_out_occupants(self):
     main.create_room("bellows", 0, "office")
     test_output = ("NAMES OF PEOPLE IN BELLOWS\n\n"
                    "There is no one in this Room!!!\n\n"
                    )
     with capture(main.print_room, "bellows") as app_output:
         self.assertEqual(
             test_output, app_output,
             msg=("print_room does not print correct room content "
                  "- {0} != {1}!!!".format(test_output, app_output))
         )
示例#8
0
    def test_print_room_with_occupants(self):
        main.create_room("bellows", 0, "office")
        main.add_person("erika", "dike", "fellow", "Y")
        test_output = ("NAMES OF PEOPLE IN BELLOWS\n\nERIKA DIKE\n\n\n")

        with capture(main.print_room, "bellows") as app_output:
            self.assertEqual(
                test_output, app_output,
                msg=("print_room does not print correct room content "
                     "- {0} != {1}!!!".format(test_output, app_output))
            )
示例#9
0
 def test_print_allocations_invalid_file(self):
     main.create_room("bellows", 0, "office")
     main.add_person("erika", "dike", "fellow", "Y")
     test_output = ("You must enter a file name with a .txt extension to "
                    "save to file\n")
     with capture(main.print_allocations, "alloc.pkl") as app_output:
         self.assertEqual(
             test_output, app_output,
             msg=("print_allocations does not detect invalid file "
                  "extensions - {0} != {1}".format(test_output, app_output))
         )
示例#10
0
 def test_invalid_person_identifiers_arguments_to_reallocate_person(self):
     main.create_room("bellows", 0, "office")
     main.add_person("erika", "dike", "staff")
     main.create_room("bench hook", 0, "office")
     test_output = ("No person was found in memory for person identifier "
                    "supplied.\n")
     with capture(main.reallocate_person, 45, "bench hook") as app_output:
         self.assertEqual(
             test_output, app_output,
             msg="{0} != {1}".format(test_output, app_output)
         )
示例#11
0
 def test_cannot_reallocate_staff_to_living_space(self):
     main.create_room("bellows", 0, "office")
     main.add_person("erika", "dike", "staff")
     main.create_room("iroko", 1, "living space")
     test_output = "You cannot allocate staff to 'living space'.\n"
     with capture(main.reallocate_person, 0, "iroko") as app_output:
         self.assertEqual(
             test_output, app_output,
             msg=("Staff cannot be reallocated to living space!!! {0} != "
                  "{1}".format(test_output, app_output))
         )
示例#12
0
 def test_does_not_allocate_to_filled_living_space(self):
     main.create_room("iroko", 1, "living space")
     main.add_person("erika", "dike", "fellow", "Y")
     main.add_person("eze", "janu", "fellow", "Y")
     main.add_person("sunday", "nwuguru", "fellow", "Y")
     main.add_person("stephen", "oduntan", "fellow", "Y")
     main.add_person("seyi", "adekoya", "fellow", "Y")
     test_output = ("No room was found in memory with that name. You may "
                    "want to create a new room with that\n"
                    "name or view all rooms in memory by requesting "
                    "allocations.\n"
                    )
     with capture(main.reallocate_person, 4, "iroko") as app_output:
         self.assertEqual(
             test_output, app_output,
             msg=("{0} != {1}".format(test_output, app_output))
         )