Exemple #1
0
    def do_print_allocations(self, args):
        """
        Prints all the rooms in the system and the people allocated to them
        Also writes out the allocations to a text file if specified

        Usage: print_allocations [--o=filename]
        """
        if args["--o"] is None:
            print(Amity.print_allocations())
        else:
            Amity.print_allocations(args["--o"])
Exemple #2
0
 def test_prints_allocations(self):
     #test it prints rooms and those allocated to them
     mock_office = mock.Mock()
     mock_office.name = "Narnia"
     mock_office.current_occupants = ["Samuel Gaamuwa"]
     Amity.offices["Narnia"] = mock_office
     Amity.print_allocations("test_out.txt")
     self.assertTrue(path.isfile("./datafiles/test_out.txt"))
     with open("./datafiles/test_out.txt") as data:
         input = data.readlines()
         self.assertIn("Narnia(office)\n", input)
         self.assertIn("Samuel Gaamuwa, \n", input)