Correct test_remote to support branchs without upstream

Change-Id: I6a78a2acc30813fe900155403bfb1dff0bfe0573
This commit is contained in:
Cedric Brandily 2014-03-27 20:46:10 +01:00
parent aab7dcae88
commit f484176563
2 changed files with 26 additions and 2 deletions

View File

@ -282,8 +282,9 @@ def set_hooks_commit_msg(remote, target_file):
def test_remote_url(remote_url):
"""Tests that a possible gerrit remote url works."""
status, __ = run_command_status("git", "push", "--dry-run", remote_url)
if status == 0:
status, __ = run_command_status("git", "push", "--dry-run", remote_url,
"--all")
if status != 128:
if VERBOSE:
print("%s worked." % remote_url)
return True

View File

@ -34,6 +34,29 @@ class GitReviewTestCase(tests.BaseGitReviewTestCase):
self._simple_change('test file modified', 'test commit message')
self.assertIn('Change-Id:', self._run_git('log', '-1'))
def test_git_review_s_in_detached_head(self):
"""Test git-review -s in detached HEAD state."""
self._run_git('remote', 'rm', 'gerrit')
self._run_git('config', '--add', 'gitreview.username', 'test_user')
master_sha1 = self._run_git('rev-parse', 'master')
self._run_git('checkout', master_sha1)
self._run_git_review('-s')
self._simple_change('test file modified', 'test commit message')
self.assertIn('Change-Id:', self._run_git('log', '-1'))
def test_git_review_s_with_outdated_repo(self):
"""Test git-review -s with a outdated repo."""
self._simple_change('test file to outdate', 'test commit message 1')
self._run_git('push', 'origin', 'master')
self._run_git('reset', '--hard', 'HEAD^')
# Review setup with an outdated repo
self._run_git('remote', 'rm', 'gerrit')
self._run_git('config', '--add', 'gitreview.username', 'test_user')
self._run_git_review('-s')
self._simple_change('test file modified', 'test commit message 2')
self.assertIn('Change-Id:', self._run_git('log', '-1'))
def test_git_review_d(self):
"""Test git-review -d."""
self._run_git_review('-s')