MCPcopy Create free account
hub / github.com/aptly-dev/aptly / TestVerifyFiles

Method TestVerifyFiles

deb/package_test.go:445–466  ·  view source on GitHub ↗
(c *C)

Source from the content-addressed store, hash-verified

443}
444
445func (s *PackageSuite) TestVerifyFiles(c *C) {
446 p := NewPackageFromControlFile(s.stanza)
447
448 packagePool := files.NewPackagePool(c.MkDir(), false)
449 cs := files.NewMockChecksumStorage()
450
451 tmpFilepath := filepath.Join(c.MkDir(), "file")
452 c.Assert(os.WriteFile(tmpFilepath, []byte("abcde"), 0777), IsNil)
453
454 p.Files()[0].PoolPath, _ = packagePool.Import(tmpFilepath, p.Files()[0].Filename, &p.Files()[0].Checksums, false, cs)
455
456 p.Files()[0].Checksums.Size = 100
457 result, err := p.VerifyFiles(packagePool, cs)
458 c.Check(err, IsNil)
459 c.Check(result, Equals, false)
460
461 p.Files()[0].Checksums.Size = 5
462
463 result, err = p.VerifyFiles(packagePool, cs)
464 c.Check(err, IsNil)
465 c.Check(result, Equals, true)
466}
467
468var packageStanza = Stanza{"Source": "alien-arena", "Pre-Depends": "dpkg (>= 1.6)", "Suggests": "alien-arena-mars", "Recommends": "aliean-arena-luna", "Depends": "libc6 (>= 2.7), alien-arena-data (>= 7.40)", "Filename": "pool/contrib/a/alien-arena/alien-arena-common_7.40-2_i386.deb", "SHA1": "46955e48cad27410a83740a21d766ce362364024", "SHA256": "eb4afb9885cba6dc70cccd05b910b2dbccc02c5900578be5e99f0d3dbf9d76a5", "Priority": "extra", "Maintainer": "Debian Games Team <pkg-games-devel@lists.alioth.debian.org>", "Description": "Common files for Alien Arena client and server ALIEN ARENA is a standalone 3D first person online deathmatch shooter\n crafted from the original source code of Quake II and Quake III, released\n by id Software under the GPL license. With features including 32 bit\n graphics, new particle engine and effects, light blooms, reflective water,\n hi resolution textures and skins, hi poly models, stain maps, ALIEN ARENA\n pushes the envelope of graphical beauty rivaling today's top games.\n .\n This package installs the common files for Alien Arena.\n", "Homepage": "http://red.planetarena.org", "Tag": "role::app-data, role::shared-lib, special::auto-inst-parts", "Installed-Size": "456", "Version": "7.40-2", "Replaces": "alien-arena (<< 7.33-1)", "Size": "187518", "MD5sum": "1e8cba92c41420aa7baa8a5718d67122", "Package": "alien-arena-common", "Section": "contrib/games", "Architecture": "i386"}
469

Callers

nothing calls this directly

Calls 8

ImportMethod · 0.95
NewPackagePoolFunction · 0.92
NewMockChecksumStorageFunction · 0.92
FilesMethod · 0.80
VerifyFilesMethod · 0.80
MkDirMethod · 0.65
CheckMethod · 0.45

Tested by

no test coverage detected