Example #1
0
    def test_copy_files(self, mock_copyfile):
        source = '/source/path'
        dest = '/dest/path'

        shell.copy(source, dest)

        mock_copyfile.assert_called_with(source, dest)
Example #2
0
    def test_copy_directories(self, mock_copytree):
        source = '/source/path'
        dest = '/dest/path'

        shell.copy(source, dest)

        mock_copytree.assert_called_with(source, dest)
Example #3
0
    def test_copy_echos_fake_cp_directory_command(self, mock_stdout):
        source = '/source/path'
        dest = '/dest/path'

        shell.copy(source, dest, echo=True)

        self.assertEqual(mock_stdout.getvalue(),
                         '>>> cp -R {} {}\n'.format(source, dest))
Example #4
0
    def test_copy_converts_pathlib_paths(self, mock_convert):
        source = Path('/source/path')
        dest = Path('/dest/path')

        shell.copy(source, dest)

        mock_convert.assert_has_calls([
            mock.call(source),
            mock.call(dest),
        ])