Exemple #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)
Exemple #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())
Exemple #3
0
    def test_error(self):
        with self.assertRaises(ValueError):
            GIT.gitz('var', '-v')

        with self.assertRaises(ValueError):
            GIT.gitz('Com', '-v')
Exemple #4
0
 def test_defaults(self):
     for d in 'd', 'def', 'defaults':
         self.assertEqual(GIT.gitz(d, '-v'), DEFAULTS)
Exemple #5
0
 def test_library_directory(self):
     for d in 'l', 'libr', 'library_directory':
         self.assertEqual(GIT.gitz(d, '-v'),
                          [str(config.LIBRARY_DIRECTORY)])
Exemple #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))
Exemple #7
0
 def test_version(self):
     for v in 'v', 've', 'version':
         self.assertEqual(GIT.gitz(v, '-v'), [config.__version__])