Ejemplo n.º 1
0
def installreveal(url):
    """Reveal.js installation command

    Receives the download url to install from a specific version or
    downloads the latest version if noting is passed
    """
    click.echo("Downloading reveal.js...")

    download = download_reveal(url)

    click.echo("Installing reveal.js...")

    move_and_replace(extract_file(download[0]), REVEALJS_FOLDER)

    click.echo("Installation completed!")
Ejemplo n.º 2
0
    def test_helper_move_and_replace(self):
        src_files = sorted(os.listdir(self.source))

        move_and_replace(self.source, self.destination)

        dst_files = sorted(os.listdir(self.destination))

        with open(os.path.join(self.destination, 'replace.txt'), 'r') as f:
            file_content = f.read()

        # The moved directory should not exist because it was moved
        self.assertFalse(os.path.exists(self.source))
        # The replaced file should contain the data from the source file
        self.assertEqual(file_content, 'source')
        # The moved files from source should be equal to the
        # files on destination directory
        self.assertEqual(src_files, dst_files)