aboutsummaryrefslogtreecommitdiff
path: root/test/git
diff options
context:
space:
mode:
authorMichael Trier <mtrier@gmail.com>2008-05-26 10:51:07 -0400
committerMichael Trier <mtrier@gmail.com>2008-05-26 10:51:07 -0400
commit27ceafbb3f74b4677d5bae6c7ea031de07c6cfad (patch)
tree1a5cf74ebc29d6b3ddc6c686133a56389cad88d2 /test/git
parent7c60b88138b836307bdde0487c4ffb82121b1c5e (diff)
parent70094734d601e1220c95ac586fdffbda3a23e10b (diff)
downloadGitPython-27ceafbb3f74b4677d5bae6c7ea031de07c6cfad.tar.gz
GitPython-27ceafbb3f74b4677d5bae6c7ea031de07c6cfad.zip
Merge git://gitorious.org/git-python/apollo13
Diffstat (limited to 'test/git')
-rw-r--r--test/git/test_git.py26
-rw-r--r--test/git/test_repo.py18
-rw-r--r--test/git/test_utils.py6
3 files changed, 15 insertions, 35 deletions
diff --git a/test/git/test_git.py b/test/git/test_git.py
index 0634a5dd..43fd231c 100644
--- a/test/git/test_git.py
+++ b/test/git/test_git.py
@@ -4,9 +4,8 @@ from git_python import *
class TestGit(object):
def setup(self):
- base = os.path.join(os.path.dirname(__file__), "../.."),
+ base = os.path.join(os.path.dirname(__file__), "../..")
self.git = Git(base)
- self.git_bin_base = "%s --git-dir=%s" % (Git.git_binary, base)
@patch(Git, 'execute')
def test_method_missing_calls_execute(self, git):
@@ -17,7 +16,7 @@ class TestGit(object):
def test_it_transforms_kwargs_into_git_command_arguments(self):
assert_equal(["-s"], self.git.transform_kwargs(**{'s': True}))
- assert_equal(["-s 5"], self.git.transform_kwargs(**{'s': 5}))
+ assert_equal(["-s", 5], self.git.transform_kwargs(**{'s': 5}))
assert_equal(["--max-count"], self.git.transform_kwargs(**{'max_count': True}))
assert_equal(["--max-count=5"], self.git.transform_kwargs(**{'max_count': 5}))
@@ -25,23 +24,4 @@ class TestGit(object):
assert_equal(["-s", "-t"], self.git.transform_kwargs(**{'s': True, 't': True}))
def test_it_executes_git_to_shell_and_returns_result(self):
- assert_match('^git version [\d\.]*$', self.git.execute("%s version" % Git.git_binary))
-
- def test_it_transforms_kwargs_shell_escapes_arguments(self):
- assert_equal(["--foo=\"bazz'er\""], self.git.transform_kwargs(**{'foo': "bazz'er"}))
- assert_equal(["-x \"bazz'er\""], self.git.transform_kwargs(**{'x': "bazz'er"}))
-
- @patch(Git, 'execute')
- def test_it_really_shell_escapes_arguments_to_the_git_shell_1(self, git):
- self.git.foo(**{'bar': "bazz'er"})
- assert_true(git.called)
- assert_equal(git.call_args, ((("%s foo --bar=\"bazz'er\"" % self.git_bin_base),), {}))
-
- @patch(Git, 'execute')
- def test_it_really_shell_escapes_arguments_to_the_git_shell_2(self, git):
- self.git.bar(**{'x': "quu'x"})
- assert_true(git.called)
- assert_equal(git.call_args, ((("%s bar -x \"quu'x\"" % self.git_bin_base),), {}))
-
- def test_it_shell_escapes_the_standalone_argument(self):
- self.git.foo("bar's", {})
+ assert_match('^git version [\d\.]*$', self.git.execute(["git","version"]))
diff --git a/test/git/test_repo.py b/test/git/test_repo.py
index 52f5856d..ff267956 100644
--- a/test/git/test_repo.py
+++ b/test/git/test_repo.py
@@ -13,7 +13,7 @@ class TestRepo(object):
@raises(NoSuchPathError)
def test_new_should_raise_on_non_existant_path(self):
- Repo("/foobar")
+ Repo("~/foobar")
def test_description(self):
assert_equal("Unnamed repository; edit this file to name it for gitweb.", self.repo.description)
@@ -108,34 +108,34 @@ class TestRepo(object):
def test_init_bare(self, repo, git):
git.return_value = True
- Repo.init_bare("/foo/bar.git")
+ Repo.init_bare("~/foo/bar.git")
assert_true(git.called)
assert_equal(git.call_args, (('init',), {}))
assert_true(repo.called)
- assert_equal(repo.call_args, (('/foo/bar.git',), {}))
+ assert_equal(repo.call_args, (('~/foo/bar.git',), {}))
@patch(Repo, '__init__')
@patch(Git, 'method_missing')
def test_init_bare_with_options(self, repo, git):
git.return_value = True
- Repo.init_bare("/foo/bar.git", **{'template': "/baz/sweet"})
+ Repo.init_bare("~/foo/bar.git", **{'template': "/baz/sweet"})
assert_true(git.called)
assert_equal(git.call_args, (('init',), {'template': '/baz/sweet'}))
assert_true(repo.called)
- assert_equal(repo.call_args, (('/foo/bar.git',), {}))
+ assert_equal(repo.call_args, (('~/foo/bar.git',), {}))
@patch(Repo, '__init__')
@patch(Git, 'method_missing')
def test_fork_bare(self, repo, git):
git.return_value = None
- self.repo.fork_bare("/foo/bar.git")
+ self.repo.fork_bare("~/foo/bar.git")
assert_true(git.called)
- assert_equal(git.call_args, (('clone', '%s/.git' % absolute_project_path(), '/foo/bar.git'), {'bare': True}))
+ assert_equal(git.call_args, (('clone', '%s/.git' % absolute_project_path(), '~/foo/bar.git'), {'bare': True}))
assert_true(repo.called)
@patch(Repo, '__init__')
@@ -143,10 +143,10 @@ class TestRepo(object):
def test_fork_bare_with_options(self, repo, git):
git.return_value = None
- self.repo.fork_bare("/foo/bar.git", **{'template': '/awesome'})
+ self.repo.fork_bare("~/foo/bar.git", **{'template': '/awesome'})
assert_true(git.called)
- assert_equal(git.call_args, (('clone', '%s/.git' % absolute_project_path(), '/foo/bar.git'),
+ assert_equal(git.call_args, (('clone', '%s/.git' % absolute_project_path(), '~/foo/bar.git'),
{'bare': True, 'template': '/awesome'}))
assert_true(repo.called)
diff --git a/test/git/test_utils.py b/test/git/test_utils.py
index a9af2040..b2b42a1c 100644
--- a/test/git/test_utils.py
+++ b/test/git/test_utils.py
@@ -6,10 +6,10 @@ class TestUtils(object):
def setup(self):
base = os.path.join(os.path.dirname(__file__), "../.."),
self.git = Git(base)
- self.git_bin_base = "%s --git-dir='%s'" % (Git.git_binary, base)
+# self.git_bin_base = "%s --git-dir='%s'" % (Git.git_binary, base)
- def test_it_escapes_single_quotes_with_shell_escape(self):
- assert_equal("\\\\'foo", shell_escape("'foo"))
+# def test_it_escapes_single_quotes_with_shell_escape(self):
+# assert_equal("\\\\'foo", shell_escape("'foo"))
def test_it_should_dashify(self):
assert_equal('this-is-my-argument', dashify('this_is_my_argument'))