Ejemplo n.º 1
0
 def test_empty_repo_file(self):
     with RollbackContext() as rollback:
         repos = get_yum_repositories()
         tmp_file_name = _create_empty_repo_file()
         rollback.prependDefer(os.remove, tmp_file_name)
         repos_after = get_yum_repositories()
         self.assertEqual(len(repos_after), len(repos))
Ejemplo n.º 2
0
 def test_empty_repo_file(self):
     with RollbackContext() as rollback:
         repos = get_yum_repositories()
         tmp_file_name = _create_empty_repo_file()
         rollback.prependDefer(os.remove, tmp_file_name)
         repos_after = get_yum_repositories()
         self.assertEqual(len(repos_after), len(repos))
Ejemplo n.º 3
0
    def test_delete_repo_from_file(self):
        repos = get_yum_repositories()
        fake_repo_3 = repos['fake-repo-3']
        delete_repo_from_file(fake_repo_3)

        repos = get_yum_repositories()
        repos_id = repos.keys()
        self.assertNotIn('fake-repo-3', repos_id)
Ejemplo n.º 4
0
    def test_delete_repo_from_file(self):
        repos = get_yum_repositories()
        fake_repo_3 = repos['fake-repo-3']
        delete_repo_from_file(fake_repo_3)

        repos = get_yum_repositories()
        repos_id = repos.keys()
        self.assertNotIn('fake-repo-3', repos_id)
Ejemplo n.º 5
0
 def _get_repos(self, errcode):
     try:
         gingerBaseLock.acquire()
         repos = get_yum_repositories()
     except Exception, e:
         gingerBaseLock.release()
         raise OperationFailed(errcode, {'err': str(e)})
Ejemplo n.º 6
0
 def _get_repos(self, errcode):
     try:
         gingerBaseLock.acquire()
         repos = get_yum_repositories()
     except Exception, e:
         gingerBaseLock.release()
         raise OperationFailed(errcode, {'err': str(e)})
Ejemplo n.º 7
0
    def test_update_repo_attributes(self):
        repos = get_yum_repositories()
        fake_repo_2 = repos['fake-repo-2']
        fake_repo_2.disable()
        fake_repo_2.name = 'This is a fake repo'
        fake_repo_2.baseurl = 'http://a.fake.repo.url'
        fake_repo_2.gpgkey = 'file://a/fake/gpg/key.fake'
        fake_repo_2.gpgcheck = False
        fake_repo_2.metalink = 'this is not a true metalink'
        fake_repo_2.mirrorlist = 'fake mirrorlist'
        write_repo_to_file(fake_repo_2)

        repos = get_yum_repositories()
        fake_repo_2 = repos['fake-repo-2']
        self.assertEqual(False, fake_repo_2.enabled)
        self.assertEqual(False, fake_repo_2.gpgcheck)
        self.assertEqual('This is a fake repo', fake_repo_2.name)
        self.assertEqual('http://a.fake.repo.url', fake_repo_2.baseurl)
        self.assertEqual('file://a/fake/gpg/key.fake', fake_repo_2.gpgkey)
        self.assertEqual('this is not a true metalink', fake_repo_2.metalink)
        self.assertEqual('fake mirrorlist', fake_repo_2.mirrorlist)
Ejemplo n.º 8
0
    def test_update_repo_attributes(self):
        repos = get_yum_repositories()
        fake_repo_2 = repos['fake-repo-2']
        fake_repo_2.disable()
        fake_repo_2.name = 'This is a fake repo'
        fake_repo_2.baseurl = 'http://a.fake.repo.url'
        fake_repo_2.gpgkey = 'file://a/fake/gpg/key.fake'
        fake_repo_2.gpgcheck = False
        fake_repo_2.metalink = 'this is not a true metalink'
        fake_repo_2.mirrorlist = 'fake mirrorlist'
        write_repo_to_file(fake_repo_2)

        repos = get_yum_repositories()
        fake_repo_2 = repos['fake-repo-2']
        self.assertEqual(False, fake_repo_2.enabled)
        self.assertEqual(False, fake_repo_2.gpgcheck)
        self.assertEqual('This is a fake repo', fake_repo_2.name)
        self.assertEqual('http://a.fake.repo.url', fake_repo_2.baseurl)
        self.assertEqual('file://a/fake/gpg/key.fake', fake_repo_2.gpgkey)
        self.assertEqual('this is not a true metalink', fake_repo_2.metalink)
        self.assertEqual('fake mirrorlist', fake_repo_2.mirrorlist)
Ejemplo n.º 9
0
 def test_get_yum_repositories(self):
     repo_files = get_repo_files()
     repo_objects = get_yum_repositories()
     self.assertGreaterEqual(len(repo_objects), len(repo_files))
Ejemplo n.º 10
0
 def test_get_yum_repositories(self):
     repo_files = get_repo_files()
     repo_objects = get_yum_repositories()
     self.assertGreaterEqual(len(repo_objects), len(repo_files))