summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/test_git_command.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/test_git_command.py b/tests/test_git_command.py
index 93300a6f..aaf21219 100644
--- a/tests/test_git_command.py
+++ b/tests/test_git_command.py
@@ -15,6 +15,7 @@
15"""Unittests for the git_command.py module.""" 15"""Unittests for the git_command.py module."""
16 16
17import re 17import re
18import os
18import unittest 19import unittest
19 20
20try: 21try:
@@ -26,6 +27,38 @@ import git_command
26import wrapper 27import wrapper
27 28
28 29
30class GitCommandTest(unittest.TestCase):
31 """Tests the GitCommand class (via git_command.git)."""
32
33 def setUp(self):
34
35 def realpath_mock(val):
36 return val
37
38 mock.patch.object(os.path, 'realpath', side_effect=realpath_mock).start()
39
40 def tearDown(self):
41 mock.patch.stopall()
42
43 def test_alternative_setting_when_matching(self):
44 r = git_command._build_env(
45 objdir = 'zap/objects',
46 gitdir = 'zap'
47 )
48
49 self.assertIsNone(r.get('GIT_ALTERNATE_OBJECT_DIRECTORIES'))
50 self.assertEqual(r.get('GIT_OBJECT_DIRECTORY'), 'zap/objects')
51
52 def test_alternative_setting_when_different(self):
53 r = git_command._build_env(
54 objdir = 'wow/objects',
55 gitdir = 'zap'
56 )
57
58 self.assertEqual(r.get('GIT_ALTERNATE_OBJECT_DIRECTORIES'), 'zap/objects')
59 self.assertEqual(r.get('GIT_OBJECT_DIRECTORY'), 'wow/objects')
60
61
29class GitCallUnitTest(unittest.TestCase): 62class GitCallUnitTest(unittest.TestCase):
30 """Tests the _GitCall class (via git_command.git).""" 63 """Tests the _GitCall class (via git_command.git)."""
31 64