コード例 #1
0
 def test_git_repoc_hash_wo_subdir(self):
     '''Test to get git repocache dir without subdir'''
     scm_object = Git(self.cli, self.tasks)
     scm_object.url = 'https://github.com/openSUSE/obs-service-tar_scm.git'
     repohash = scm_object.get_repocache_hash(None)
     self.assertEqual(
         repohash,
         'c0f3245498ad916e9ee404acfd7aa59e29d53b7a063a8609735c1284c67b2161')
コード例 #2
0
 def test_git_repoc_hash_wo_subdir(self):
     '''Test to get git repocache dir without subdir'''
     scm_object = Git(self.cli, self.tasks)
     scm_object.url = 'https://github.com/openSUSE/obs-service-tar_scm.git'
     repohash = scm_object.get_repocache_hash(None)
     self.assertEqual(
         repohash,
         'c0f3245498ad916e9ee404acfd7aa59e29d53b7a063a8609735c1284c67b2161')
コード例 #3
0
 def test_git_repoc_hash_w_subdir(self):
     '''
     This test case proves that subdir is ignored in
     TarSCM.base.scm.get_repocache_hash
     '''
     scm_object = Git(self.cli, self.tasks)
     scm_object.url = 'https://github.com/openSUSE/obs-service-tar_scm.git'
     repohash = scm_object.get_repocache_hash('subdir')
     self.assertEqual(
         repohash,
         'c0f3245498ad916e9ee404acfd7aa59e29d53b7a063a8609735c1284c67b2161')
コード例 #4
0
 def test_git_repoc_hash_w_subdir(self):
     '''
     This test case proves that subdir is ignored in
     TarSCM.base.scm.get_repocache_hash
     '''
     scm_object = Git(self.cli, self.tasks)
     scm_object.url = 'https://github.com/openSUSE/obs-service-tar_scm.git'
     repohash = scm_object.get_repocache_hash('subdir')
     self.assertEqual(
         repohash,
         'c0f3245498ad916e9ee404acfd7aa59e29d53b7a063a8609735c1284c67b2161')
コード例 #5
0
    def test_calc_dir_to_clone_to(self):

        clone_dirs = [
            '/local/repo.git',
            '/local/repo/.git',
            '/local/repo/.git/',
            'http://remote/repo.git;param?query#fragment',
            'http://remote/repo/.git;param?query#fragment',
        ]

        scm = Git(self.cli, self.tasks)

        for cdir in clone_dirs:
            scm.url = cdir
            scm._calc_dir_to_clone_to("")  # pylint: disable=protected-access
            self.assertTrue(scm.clone_dir.endswith('/repo'))
            self.tasks.cleanup()
コード例 #6
0
    def test_calc_dir_to_clone_to(self):

        clone_dirs = [
            '/local/repo.git',
            '/local/repo/.git',
            '/local/repo/.git/',
            'http://remote/repo.git;param?query#fragment',
            'http://remote/repo/.git;param?query#fragment',
        ]

        scm = Git(self.cli, self.tasks)

        for cdir in clone_dirs:
            scm.url = cdir
            scm._calc_dir_to_clone_to("")  # pylint: disable=protected-access
            self.assertTrue(scm.clone_dir.endswith('/repo'))
            self.tasks.cleanup()
コード例 #7
0
 def test_git_mirror_arg_insert(self):
     f_args  = FakeCli()
     f_tasks = FakeTasks()
     git = Git(f_args, f_tasks)
     git.fetch_specific_revision = mock.MagicMock()
     git.repodir = '/tmp'
     git.pardir = '/foo'
     clone_url = 'https://clone_url'
     clone_dir = '/tmp/clone_dir'
     git.url = clone_url
     git.clone_dir = clone_dir
     with mock.patch.object(Helpers, 'safe_run') as mock_save_run:
         git.fetch_upstream_scm()
         ((command,), kwargs) = mock_save_run.call_args  # noqa: E501 pylint: disable=W0612
         expected_command = [
             'git', '-c', 'http.proxy=http://myproxy', 'clone', '--mirror',
             clone_url, clone_dir]
         self.assertEqual(expected_command, command)