예제 #1
0
    def test_all(self):
        # See #170
        indent_commands = (('    ' if c else '') + c for c in COMMANDS)
        indent_commands = '\n'.join(indent_commands)
        home_page = config.HOME_PAGE
        executable_directory = str(config.EXECUTABLE_DIRECTORY)
        library_directory = str(config.LIBRARY_DIRECTORY)
        version = config.__version__
        python_version = platform.python_version()
        platform_name = platform.platform()
        commands = list(_commands())
        indent_commands = indent_commands

        def filter_results(lines):
            results = []
            prev = ''
            py = '    Python'
            xd = 'Executable directory:'
            for line in lines:
                if not (line.startswith(py) or prev.startswith(xd)):
                    results.append(line)
                prev = line
            return results

        results = RESULTS.format(**locals())
        expected = filter_results(results.splitlines())
        actual = filter_results(GIT.gitz('-v'))
        self.assertEqual(expected, actual)
예제 #2
0
 def test_executable_directory(self):
     result = {
         GIT.gitz(d, '-v')[0]
         for d in ('e', 'exec', 'executable_directory')
     }
     self.assertEqual(len(result), 1)
     result = next(iter(result))
     self.assertTrue((Path(result) / 'git-gitz').exists())
예제 #3
0
    def test_error(self):
        with self.assertRaises(ValueError):
            GIT.gitz('var', '-v')

        with self.assertRaises(ValueError):
            GIT.gitz('Com', '-v')
예제 #4
0
 def test_defaults(self):
     for d in 'd', 'def', 'defaults':
         self.assertEqual(GIT.gitz(d, '-v'), DEFAULTS)
예제 #5
0
 def test_library_directory(self):
     for d in 'l', 'libr', 'library_directory':
         self.assertEqual(GIT.gitz(d, '-v'),
                          [str(config.LIBRARY_DIRECTORY)])
예제 #6
0
 def test_commands(self):
     expected = COMMANDS
     for c in 'c', 'com', 'commands':
         actual = GIT.gitz(c, '-v')
         self.assertEqual(actual, expected)
         self.assertEqual(len(actual), len(expected))
예제 #7
0
 def test_version(self):
     for v in 'v', 've', 'version':
         self.assertEqual(GIT.gitz(v, '-v'), [config.__version__])