def test_clean_no_url(self, mock_shell):
        parsed_options = {
            'url': None,
            'working_dir': '/tmp/working',
            'clean': True
        }

        options = Values(defaults=parsed_options)

        # test

        builder.clean(options)

        # validation

        self.assertFalse(mock_shell.called)
    def test_clean_no_url(self, mock_shell):
        parsed_options = {
            'url': None,
            'working_dir': '/tmp/working',
            'clean': True
        }

        options = Values(defaults=parsed_options)

        # test

        builder.clean(options)

        # validation

        self.assertFalse(mock_shell.called)
    def test_clean_not_requested(self, mock_shell):
        parsed_options = {
            'url': 'http://',
            'working_dir': '/tmp/working',
            'clean': False
        }

        options = Values(defaults=parsed_options)

        # test

        builder.clean(options)

        # validation

        self.assertFalse(mock_shell.called)
    def test_clean_not_requested(self, mock_shell):
        parsed_options = {
            'url': 'http://',
            'working_dir': '/tmp/working',
            'clean': False
        }

        options = Values(defaults=parsed_options)

        # test

        builder.clean(options)

        # validation

        self.assertFalse(mock_shell.called)
    def test_clean(self, mock_shell):
        parsed_options = {
            'url': 'http://',
            'working_dir': '/tmp/working',
            'clean': True
        }

        options = Values(defaults=parsed_options)

        # test

        builder.clean(options)

        # validation

        path = os.path.join(options.working_dir, os.path.basename(options.url))
        mock_shell.assert_called_with('rm -rf %s' % path)
    def test_clean(self, mock_shell):
        parsed_options = {
            'url': 'http://',
            'working_dir': '/tmp/working',
            'clean': True
        }

        options = Values(defaults=parsed_options)

        # test

        builder.clean(options)

        # validation

        path = os.path.join(options.working_dir, os.path.basename(options.url))
        mock_shell.assert_called_with('rm -rf %s' % path)
    def test_clean(self, mock_shell):
        parsed_options = {
            'url': 'git@test:foo/bar.git',
            'working_dir': '/tmp/working',
            'clean': True
        }

        options = Values(defaults=parsed_options)

        # test

        builder.clean(options)

        # validation
        url = urlparse(options.url)
        path = os.path.basename(url.path)
        path = os.path.splitext(path)[0]
        path = os.path.join(options.working_dir, path)
        mock_shell.assert_called_with('rm -rf %s' % path)
    def test_clean(self, mock_shell):
        parsed_options = {
            'url': 'git@test:foo/bar.git',
            'working_dir': '/tmp/working',
            'clean': True
        }

        options = Values(defaults=parsed_options)

        # test

        builder.clean(options)

        # validation
        url = urlparse(options.url)
        path = os.path.basename(url.path)
        path = os.path.splitext(path)[0]
        path = os.path.join(options.working_dir, path)
        mock_shell.assert_called_with('rm -rf %s' % path)