Esempio n. 1
0
    def test_bad_input(self):
        """Test retrieve_git_hash() catches directories that do not exist."""

        with self.assertRaises(IOError):
            repository_path = os.path.join(
                TMP_PATH,
                'does',
                'not',
                'exist',
            )
            retrieve_git_hash(repository_path)
Esempio n. 2
0
    def test_retrieve(self):
        """Test retrieve_git_hash() can fetch git hash."""

        # Valid path, valid repository.
        repository_path = os.path.join(MCL_ROOT, '.git')
        hsh = retrieve_git_hash(repository_path)
        self.assertNotEqual(hsh, None)
        self.assertNotEqual(hsh, '')
        self.assertGreaterEqual(len(hsh), 1)

        # Valid path, no repository.
        repository_path = os.path.join(MCL_ROOT, 'mcl')
        hsh = retrieve_git_hash(repository_path)
        self.assertEqual(hsh, None)
Esempio n. 3
0
    def test_retrieve(self):
        """Test retrieve_git_hash() can fetch git hash."""

        # Valid path, valid repository.
        repository_path = os.path.join(MCL_ROOT, '.git')
        hsh = retrieve_git_hash(repository_path)
        self.assertNotEqual(hsh, None)
        self.assertNotEqual(hsh, '')
        self.assertGreaterEqual(len(hsh), 1)

        # Valid path, no repository.
        repository_path = os.path.join(MCL_ROOT, 'mcl')
        hsh = retrieve_git_hash(repository_path)
        self.assertEqual(hsh, None)
Esempio n. 4
0
    def test_bad_input(self):
        """Test retrieve_git_hash() catches directories that do not exist."""

        with self.assertRaises(IOError):
            repository_path = os.path.join(TMP_PATH, 'does', 'not', 'exist', )
            retrieve_git_hash(repository_path)