MCPcopy
hub / github.com/aptly-dev/aptly / TestBuildDownloadQueueLatestOnly

Method TestBuildDownloadQueueLatestOnly

deb/remote_test.go:426–453  ·  view source on GitHub ↗
(c *C)

Source from the content-addressed store, hash-verified

424}
425
426func (s *RemoteRepoSuite) TestBuildDownloadQueueLatestOnly(c *C) {
427 s.repo.Architectures = []string{"i386"}
428
429 err := s.repo.Fetch(s.downloader, nil, true)
430 c.Assert(err, IsNil)
431
432 s.downloader.ExpectError("http://mirror.yandex.ru/debian/dists/squeeze/main/binary-i386/Packages.bz2", &http.Error{Code: 404})
433 s.downloader.ExpectError("http://mirror.yandex.ru/debian/dists/squeeze/main/binary-i386/Packages.gz", &http.Error{Code: 404})
434 s.downloader.ExpectResponse("http://mirror.yandex.ru/debian/dists/squeeze/main/binary-i386/Packages", examplePackagesFile)
435
436 err = s.repo.DownloadPackageIndexes(s.progress, s.downloader, nil, s.collectionFactory, true, false)
437 c.Assert(err, IsNil)
438 c.Assert(s.downloader.Empty(), Equals, true)
439
440 stanza := packageStanza.Copy()
441 stanza["Package"] = "amanda-client"
442 stanza["Version"] = "1:3.4.0-1"
443 stanza["Filename"] = "pool/main/a/amanda/amanda-client_3.4.0-1_i386.deb"
444
445 newest := NewPackageFromControlFile(stanza)
446 _ = s.repo.packageList.Add(newest)
447
448 queue, size, err := s.repo.BuildDownloadQueue(s.packagePool, s.collectionFactory.PackageCollection(), s.cs, false, true)
449 c.Assert(err, IsNil)
450 c.Check(queue, HasLen, 1)
451 c.Check(queue[0].File.DownloadURL(), Equals, "pool/main/a/amanda/amanda-client_3.4.0-1_i386.deb")
452 c.Check(size, Equals, int64(187518))
453}
454
455func (s *RemoteRepoSuite) TestDownloadWithSources(c *C) {
456 s.repo.Architectures = []string{"i386"}

Callers

nothing calls this directly

Calls 12

FetchMethod · 0.80
ExpectErrorMethod · 0.80
ExpectResponseMethod · 0.80
BuildDownloadQueueMethod · 0.80
PackageCollectionMethod · 0.80
DownloadURLMethod · 0.80
EmptyMethod · 0.45
CopyMethod · 0.45
AddMethod · 0.45
CheckMethod · 0.45

Tested by

no test coverage detected