def test_a_game_should_be_exported(self): settings_manager = SettingsManager('mySettings.xml') settings_manager.load() game = Game() game.set_settings_manager(settings_manager) game.initial_sudoku = SudokuBoard() game.initial_sudoku.from_dictionary(self.puzzle, True) export_command = ExportCommand(self.valid_params) export_command.set_game(game) export_command.execute() exported_file = open('puzzle_file.txt') self.assertEqual(self.exported_content, exported_file.readline())
def test_an_InvalidCmdParametersException_should_be_raised_if_initial_sudoku_is_None(self): with self.assertRaises(InvalidCmdParametersException): game = Game() cmd = ExportCommand(self.valid_params) cmd.set_game(game) cmd.execute()
def test_an_InvalidCmdParametersException_should_be_raised_if_game_is_None(self): with self.assertRaises(InvalidCmdParametersException): cmd = ExportCommand(self.valid_params) cmd.execute()