def test_command_interactive_n(self, mock_input): create_file_and_write('file.txt') cmd = Command() cmd.handle(interactive=True) expect(cmd.stdout.getvalue().split('\n'))\ .to_include('Interrupted by user. Exit.') expect(exists_media_path('file.txt')).to_be_true()
def test_command_interactive_n(self, mock_input): create_file_and_write(u'file.txt') cmd = Command() cmd.handle(interactive=True) expect(cmd.stdout.getvalue().split('\n'))\ .to_include('Interrupted by user. Exit.') expect(exists_media_path(u'file.txt')).to_be_true()
def test_command_interactive_y_with_ascii(self, mock_input): create_file_and_write(u'Тест.txt') cmd = Command() cmd.handle(interactive=True) expect(cmd.stdout.getvalue().split('\n'))\ .to_include('Remove Тест.txt')\ .to_include('Done. 1 unused files have been removed') expect(exists_media_path(u'Тест.txt')).to_be_false()
def test_command_not_interactive(self): create_file_and_write('file.txt') cmd = Command() cmd.handle(interactive=False) expect(cmd.stdout.getvalue().split('\n'))\ .to_include('Remove file.txt')\ .to_include('Done. 1 unused files have been removed') expect(exists_media_path('file.txt')).to_be_false()
def test_command_interactive_y(self, mock_input): create_file_and_write(u'file.txt') cmd = Command() cmd.handle(interactive=True) expect(cmd.stdout.getvalue().split('\n'))\ .to_include('Remove {}'.format(self.__make_abs_path('file.txt')))\ .to_include('Done. 1 unused files have been removed') expect(exists_media_path(u'file.txt')).to_be_false()
def test_command_interactive_y(self, mock_input): create_file_and_write('file.txt') cmd = Command() cmd.handle(interactive=True) expect(cmd.stdout.getvalue().split('\n'))\ .to_include('Remove file.txt')\ .to_include('Done. 1 unused files have been removed') expect(exists_media_path('file.txt')).to_be_false()
def test_command_nothing_to_delete(self): cmd = Command() cmd.handle(interactive=False) expect(cmd.stdout.getvalue().split('\n'))\ .to_include('Nothing to delete. Exit')
def test_command_nothing_to_delete(self): cmd = Command() cmd.handle(interactive=False) expect(cmd.stdout.getvalue().split('\n'))\ .to_include('Nothing to delete. Exit')