Exemple #1
0
    def test_default_maxreleases(self):
        """
        Run 7 deploys and verify that 5 are saved, and that the first release
        is really removed.
        """

        hooks.register_hook("copy", empty_copy)

        with settings(source_path="src", warn_only=True):
            setup()

            deploy()

            release_name = paths.get_current_release_name()
            first_release_path = paths.get_releases_path(release_name)

            # TODO: Find a better solution then using time.sleep
            for i in range(6):
                time.sleep(1)
                deploy()

            releases = len(os.listdir(paths.get_releases_path()))

            self.assertEquals(releases, 5)
            self.assertFalse(env.exists(first_release_path))
Exemple #2
0
    def test_deploy_copy(self):
        hooks.register_hook("copy", git.copy)

        with self.assertRaises(SystemExit) as context:
            deploy()

        self.assertTrue("You need to run setup before running deploy" in
                        context.exception)
Exemple #3
0
    def test_deploy_setup(self):
        hooks.register_hook("copy", git.copy)

        setup()

        with self.assertRaises(SystemExit) as context:
            deploy()

        self.assertTrue("repro_url" in context.exception.message)
Exemple #4
0
    def test_deploy_flow(self):
        hooks.register_hook("copy", git.copy)

        with settings(source_path="src", warn_only=True):
            deploy()

        self.assertTrue(self.out[-4].endswith('current'))
        self.assertEquals(
            self.out[-1],
            "python manage.py collectstatic --noinput"
        )
Exemple #5
0
    def test_deploy_404_repro(self):
        hooks.register_hook("copy", git.copy)

        with settings(
                branch="develop",
                repro_url="git://github.com/Frojd/Frojd-Django-Boilerplate1.git",  # NOQA
                source_path="src",
                warn_only=True):

            setup()

            with self.assertRaises(Exception):
                deploy()
Exemple #6
0
    def test_deploy_repro(self):
        hooks.register_hook("copy", git.copy)

        with settings(
                branch="develop",
                repro_url="git://github.com/Frojd/Wagtail-Boilerplate.git",  # NOQA
                source_path="{{cookiecutter.project_name}}",
                warn_only=True):

            setup()
            deploy()

            self.assertTrue(os.path.exists(os.path.join(
                env.app_path, "current", "Makefile")
            ))
Exemple #7
0
    def test_deploy_rollback(self):
        hooks.register_hook("copy", empty_copy)

        with settings(
                source_path="src",
                warn_only=True):

            setup()
            deploy()

            release_name = paths.get_current_release_name()

            deploy()  # Run another callback so we can can roll back
            rollback()

            self.assertTrue(os.path.exists(os.path.join(
                env.app_path, "current", "app.txt")
            ))

            releases = len(os.listdir(os.path.join(env.app_path, "releases")))

            self.assertEquals(releases, 1)
            self.assertTrue(env.exists(paths.get_releases_path(release_name)))
Exemple #8
0
    def test_deploy(self):
        with self.assertRaises(SystemExit) as context:
            deploy()

        self.assertTrue("No copy method has been defined" in context.exception)