Esempio n. 1
0
    def test_push_dry_run(self, capfd):
        """
        When ``push`` is called, and dry_run is True, the Docker command should
        be printed but not executed.
        """
        runner = DockerCiDeployRunner(dry_run=True)
        runner.docker_push('foo')

        assert_output_lines(capfd, ['docker push foo'])
Esempio n. 2
0
    def test_push(self, capfd):
        """
        When ``push`` is called, the Docker CLI should be called with the
        'push' command and the image tag.
        """
        runner = DockerCiDeployRunner(executable='echo')
        runner.docker_push('foo')

        assert_output_lines(capfd, ['push foo'])
Esempio n. 3
0
    def test_push_verbose(self, capfd):
        """
        When ``push`` is called, and verbose is True, a message should be
        logged.
        """
        runner = DockerCiDeployRunner(executable='echo', verbose=True)
        runner.docker_push('foo')

        assert_output_lines(capfd, ['Pushing tag "foo"...', 'push foo'])
Esempio n. 4
0
    def test_tag_same_tag(self, capfd):
        """
        When ``tag`` is called, and the output tag is the same as the input
        tag, the command should not be executed.
        """
        runner = DockerCiDeployRunner(executable='echo')
        runner.docker_tag('bar', 'bar')

        assert_output_lines(capfd, [], [])
Esempio n. 5
0
    def test_tag_dry_run(self, capfd):
        """
        When ``tag`` is called, and dry_run is True, the Docker command should
        be printed but not executed.
        """
        runner = DockerCiDeployRunner(dry_run=True)
        runner.docker_tag('foo', 'bar')

        assert_output_lines(capfd, ['docker tag foo bar'])
Esempio n. 6
0
    def test_tag(self, capfd):
        """
        When ``tag`` is called, the Docker CLI should be called with the 'tag'
        command and the source and target tags.
        """
        runner = DockerCiDeployRunner(executable='echo')
        runner.docker_tag('foo', 'bar')

        assert_output_lines(capfd, ['tag foo bar'])
Esempio n. 7
0
    def test_tag_same_tag_verbose(self, capfd):
        """
        When ``tag`` is called, and the output tag is the same as the input
        tag, and verbose is True, a message should be logged that explains that
        no tagging will be done.
        """
        runner = DockerCiDeployRunner(executable='echo', verbose=True)
        runner.docker_tag('bar', 'bar')

        assert_output_lines(capfd, ['Not tagging "bar" as itself'])
Esempio n. 8
0
    def test_tag_verbose(self, capfd):
        """
        When ``tag`` is called, and verbose is True, a message should be
        logged.
        """
        runner = DockerCiDeployRunner(executable='echo', verbose=True)
        runner.docker_tag('foo', 'bar')

        assert_output_lines(capfd,
                            ['Tagging "foo" as "bar"...', 'tag foo bar'])