Ejemplo n.º 1
0
    def test_starttheme_from_project_root(self):
        """Creates the following directory structure within
        the themes directory:
        - mytheme
            - templates/
                - base.twig
            - static/
                - css/
                - images/
                - js/
            - 404.php
            - functions.php
            - index.php
            - style.css
            - README.md
            - .gitignore
        """
        args = PseudoArgs(name='mytheme', project_root=self.wp_dir.path)

        wpadmin.starttheme(args)

        mytheme = os.path.join(self.theme_roots, 'mytheme')

        path_to_base_twig = os.path.join(mytheme, 'templates', 'base.twig')

        self.assertTrue(os.path.isfile(path_to_base_twig))

        for d in ['css', 'images', 'js']:
            path_to_dir = os.path.join(mytheme, 'static', d)
            self.assertTrue(os.path.isdir(path_to_dir))

        theme_files = [
            '404.php',
            'functions.php',
            'index.php',
            'style.css',
            'README.md',
            '.gitignore'
        ]

        for f in theme_files:
            self.assertTrue(os.path.isfile(os.path.join(mytheme, f)))
Ejemplo n.º 2
0
    def test_starttheme_from_project_root_with_classic_option(self):
        """Creates the following directory structure within
        the themes directory:

        - mytheme
            - css/
            - images/
            - js/
            - 404.php
            - functions.php
            - index.php
            - style.css
            - README.md
            - .gitignore
        """
        context = {
            'name': 'mytheme',
            'classic': True,
            'project_root': self.wp_dir.path
        }

        args = PseudoArgs(**context)

        wpadmin.starttheme(args)

        mytheme = os.path.join(self.theme_roots, 'mytheme')

        for d in ['css', 'images', 'js']:
            self.assertTrue(os.path.isdir(os.path.join(mytheme, d)))

        theme_files = [
            '404.php',
            'functions.php',
            'index.php',
            'style.css',
            'README.md',
            '.gitignore'
        ]

        for f in theme_files:
            self.assertTrue(os.path.isfile(os.path.join(mytheme, f)))