Beispiel #1
0
func (s *RemoteRepoSuite) TestDownloadFlat(c *C) {
	downloader := utils.NewFakeDownloader()
	downloader.ExpectResponse("http://repos.express42.com/virool/precise/Release", exampleReleaseFile)
	downloader.ExpectError("http://repos.express42.com/virool/precise/Packages.bz2", errors.New("HTTP 404"))
	downloader.ExpectError("http://repos.express42.com/virool/precise/Packages.gz", errors.New("HTTP 404"))
	downloader.ExpectResponse("http://repos.express42.com/virool/precise/Packages", examplePackagesFile)
	downloader.ExpectResponse("http://repos.express42.com/virool/precise/pool/main/a/amanda/amanda-client_3.3.1-3~bpo60+1_amd64.deb", "xyz")

	err := s.flat.Fetch(downloader, nil)
	c.Assert(err, IsNil)

	err = s.flat.Download(downloader, s.packageCollection, s.packageRepo, false)
	c.Assert(err, IsNil)
	c.Assert(downloader.Empty(), Equals, true)
	c.Assert(s.flat.packageRefs, NotNil)

	pkg, err := s.packageCollection.ByKey(s.flat.packageRefs.Refs[0])
	c.Assert(err, IsNil)

	result, err := pkg.VerifyFiles(s.packageRepo)
	c.Check(result, Equals, true)
	c.Check(err, IsNil)

	c.Check(pkg.Name, Equals, "amanda-client")
}
Beispiel #2
0
func (s *RemoteRepoSuite) SetUpTest(c *C) {
	s.repo, _ = NewRemoteRepo("yandex", "http://mirror.yandex.ru/debian/", "squeeze", []string{"main"}, []string{}, false)
	s.flat, _ = NewRemoteRepo("exp42", "http://repos.express42.com/virool/precise/", "./", []string{}, []string{}, false)
	s.downloader = utils.NewFakeDownloader().ExpectResponse("http://mirror.yandex.ru/debian/dists/squeeze/Release", exampleReleaseFile)
	s.db, _ = database.OpenDB(c.MkDir())
	s.packageCollection = NewPackageCollection(s.db)
	s.packageRepo = NewRepository(c.MkDir())
	s.SetUpPackages()
}
Beispiel #3
0
func (s *RemoteRepoSuite) TestFetchNullVerifier2(c *C) {
	downloader := utils.NewFakeDownloader()
	downloader.ExpectResponse("http://mirror.yandex.ru/debian/dists/squeeze/InRelease", exampleReleaseFile)

	err := s.repo.Fetch(downloader, &NullVerifier{})
	c.Assert(err, IsNil)
	c.Assert(s.repo.Architectures, DeepEquals, []string{"amd64", "armel", "armhf", "i386", "powerpc"})
	c.Assert(s.repo.Components, DeepEquals, []string{"main"})
	c.Assert(downloader.Empty(), Equals, true)
}
Beispiel #4
0
func (s *RemoteRepoSuite) SetUpTest(c *C) {
	s.repo, _ = NewRemoteRepo("yandex", "http://mirror.yandex.ru/debian/", "squeeze", []string{"main"}, []string{})
	s.downloader = utils.NewFakeDownloader().ExpectResponse("http://mirror.yandex.ru/debian/dists/squeeze/Release", exampleReleaseFile)
	s.SetUpPackages()
}