def test_load_images_with_image_file(self, mock_listdir, mock_image_open): mock_listdir.return_value = ["test.txt", "test2.jpg"] directory = "/home/test/" returned_image = Image.new("RGB", (800, 600)) mock_image_open.return_value = returned_image returned_images = Application.load_images(directory, False) mock_image_open.assert_called_with( os.path.join(directory, mock_listdir.return_value[1])) self.assertListEqual([returned_image], returned_images)
def test_load_images_with_wrong_filetype(self, mock_listdir): mock_listdir.return_value = ["test.txt", "test2"] returned_images = Application.load_images("/home/test/", False) self.assertListEqual([], returned_images)