Exemplo n.º 1
0
 def test_get_cached(self):
     with librepo_mock() as mock:
         cache = repo_cache.RepoCache()
         mock.reset_mock()
         self.assertEqual({'x86_64': MockRepo, 'i386': MockRepo},
                          cache.get_repos(666))
         self.assertFalse(mock.perform.called)
Exemplo n.º 2
0
 def test_lru_basic(self):
     with librepo_mock():
         cache = repo_cache.RepoCache()
         cache.get_repo(123, 'x86_64')
         cache.get_repo(2000, 'i386')
         self.assertEqual({'2000', '123', '1024', 'not-repo'},
                          set(os.listdir('.')))
Exemplo n.º 3
0
 def test_lru_more(self):
     with librepo_mock():
         cache = repo_cache.RepoCache()
         for repo in 5555, 666, 1024, 2000, 123, 7:
             cache.get_repo(repo, 'x86_64')
         self.assertEqual({'2000', '123', '7', 'not-repo'},
                          set(os.listdir('.')))
Exemplo n.º 4
0
 def test_read_from_disk(self):
     with librepo_mock() as mock:
         repo_cache.RepoCache()
         repos = 7, 123, 666, 1024
         mock.mock_local.assert_has_calls([call(True)] * 4)
         mock.mock_repotype.assert_has_calls([call(librepo.LR_YUMREPO)] * 4)
         mock.mock_yumdlist.assert_has_calls([call(['primary', 'filelists', 'group'])] * 4)
         mock.mock_urls.assert_has_calls([call([p]) for p in repodirs(repos)])
         self.assertEqual(8, mock.perform.call_count)
Exemplo n.º 5
0
 def test_download(self):
     with librepo_mock() as mock:
         cache = repo_cache.RepoCache()
         mock.reset_mock()
         self.assertEqual(MockRepo, cache.get_repo(2000, 'i386'))
         mock.mock_repotype.assert_has_calls([call(librepo.LR_YUMREPO)] * 2)
         mock.mock_yumdlist.assert_has_calls(
             [call(['primary', 'filelists', 'group'])] * 2)
         mock.mock_urls.assert_has_calls(
             [call([p]) for p in repourls([2000])])
         mock.mock_destdir.assert_has_calls(
             [call(p) for p in repodirs([2000])])
         self.assertEqual({'2000', '666', '1024', 'not-repo'},
                          set(os.listdir('.')))
Exemplo n.º 6
0
 def test_lru_init(self):
     with librepo_mock():
         repo_cache.RepoCache()
         self.assertEqual({'123', '666', '1024', 'not-repo'}, set(os.listdir('.')))