Exemplo n.º 1
0
 def test_bad_repo(self):
     """
     Test git
     """
     log.debug("Test non-git directory")
     with self.assertRaises(InvalidGitRepo):
         fail_git = IDKGit("/tmp")
         fail_git.branches()
Exemplo n.º 2
0
    def setUpClass(cls):
        system("rm -rf %s" % ROOTDIR)
        if not exists(ROOTDIR):
            makedirs(ROOTDIR)

        idk_git = IDKGit(ROOTDIR)
        log.info("clone repo %s", REPO)
        idk_git.clone(REPO)
Exemplo n.º 3
0
 def test_bad_repo(self):
     """
     Test git
     """
     log.debug("Test non-git directory")
     with self.assertRaises(InvalidGitRepo):
         fail_git = IDKGit("/tmp")
         fail_git.branches()
Exemplo n.º 4
0
    def setUpClass(cls):
        system("rm -rf %s" % ROOTDIR)
        if not exists(ROOTDIR):
            makedirs(ROOTDIR)

        idk_git = IDKGit(ROOTDIR)
        log.info("clone repo %s", REPO)
        idk_git.clone(REPO)
Exemplo n.º 5
0
 def setUp(self):
     """
     Setup the test case
     """
     log.debug("Test good git directory")
     self.idk_git = IDKGit(ROOTDIR)
     self.assertTrue(self.idk_git)
     self.assertTrue(self.idk_git.repo)
     self.assertTrue(self.idk_git.repo.isValid())
Exemplo n.º 6
0
 def setUp(self):
     """
     Setup the test case
     """
     log.debug("Test good git directory")
     self.idk_git = IDKGit(ROOTDIR)
     self.assertTrue(self.idk_git)
     self.assertTrue(self.idk_git.repo)
     self.assertTrue(self.idk_git.repo.isValid())
Exemplo n.º 7
0
class TestGit(MiUnitTest):
    """
    Test the git for the IDK
    """

    @classmethod
    def setUpClass(cls):
        system("rm -rf %s" % ROOTDIR)
        if not exists(ROOTDIR):
            makedirs(ROOTDIR)

        idk_git = IDKGit(ROOTDIR)
        log.info("clone repo %s", REPO)
        idk_git.clone(REPO)

    @classmethod
    def tearDownClass(cls):
        system("rm -rf %s" % ROOTDIR)

    def setUp(self):
        """
        Setup the test case
        """
        log.debug("Test good git directory")
        self.idk_git = IDKGit(ROOTDIR)
        self.assertTrue(self.idk_git)
        self.assertTrue(self.idk_git.repo)
        self.assertTrue(self.idk_git.repo.isValid())

    def test_bad_repo(self):
        """
        Test git
        """
        log.debug("Test non-git directory")
        with self.assertRaises(InvalidGitRepo):
            fail_git = IDKGit("/tmp")
            fail_git.branches()

    def test_branch(self):
        branches = self.idk_git.branches()
        log.debug("Branches found: %s", branches)

        # Add a branch
        branch_name = "test_idk_branch"
        self.idk_git.create_branch(branch_name)
        branches = self.idk_git.branches()
        log.debug("Branches found: %s", branches)
        self.assertTrue(branch_name in branches)

        # add the same branch again
        with self.assertRaises(GitCommandException):
            self.idk_git.create_branch(branch_name)

        # switch to the new branch
        self.idk_git.switch_branch(branch_name)
        self.assertEqual(self.idk_git.get_current_branch(), branch_name)

        # switch to the master
        self.idk_git.switch_branch("master")
        self.assertEqual(self.idk_git.get_current_branch(), "master")

        # switch to an unknown branch
        with self.assertRaises(GitCommandException):
            self.idk_git.switch_branch("fffsssaaa")
Exemplo n.º 8
0
class TestGit(MiUnitTest):
    """
    Test the git for the IDK
    """
    @classmethod
    def setUpClass(cls):
        system("rm -rf %s" % ROOTDIR)
        if not exists(ROOTDIR):
            makedirs(ROOTDIR)

        idk_git = IDKGit(ROOTDIR)
        log.info("clone repo %s", REPO)
        idk_git.clone(REPO)

    @classmethod
    def tearDownClass(cls):
        system("rm -rf %s" % ROOTDIR)

    def setUp(self):
        """
        Setup the test case
        """
        log.debug("Test good git directory")
        self.idk_git = IDKGit(ROOTDIR)
        self.assertTrue(self.idk_git)
        self.assertTrue(self.idk_git.repo)
        self.assertTrue(self.idk_git.repo.isValid())

    def test_bad_repo(self):
        """
        Test git
        """
        log.debug("Test non-git directory")
        with self.assertRaises(InvalidGitRepo):
            fail_git = IDKGit("/tmp")
            fail_git.branches()

    def test_branch(self):
        branches = self.idk_git.branches()
        log.debug("Branches found: %s", branches)

        # Add a branch
        branch_name = 'test_idk_branch'
        self.idk_git.create_branch(branch_name)
        branches = self.idk_git.branches()
        log.debug("Branches found: %s", branches)
        self.assertTrue(branch_name in branches)

        # add the same branch again
        with self.assertRaises(GitCommandException):
            self.idk_git.create_branch(branch_name)

        # switch to the new branch
        self.idk_git.switch_branch(branch_name)
        self.assertEqual(self.idk_git.get_current_branch(), branch_name)

        # switch to the master
        self.idk_git.switch_branch('master')
        self.assertEqual(self.idk_git.get_current_branch(), 'master')

        # switch to an unknown branch
        with self.assertRaises(GitCommandException):
            self.idk_git.switch_branch('fffsssaaa')