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

Method TestImportChangesFiles

deb/changes_test.go:89–132  ·  view source on GitHub ↗
(c *C)

Source from the content-addressed store, hash-verified

87}
88
89func (s *ChangesSuite) TestImportChangesFiles(c *C) {
90 repo := NewLocalRepo("test", "Test Comment")
91 c.Assert(s.localRepoCollection.Add(repo), IsNil)
92
93 origFailedFiles := []string{
94 "testdata/changes/calamares.changes",
95 "testdata/changes/hardlink_0.2.1-invalidfiles_amd64.changes",
96 "testdata/changes/hardlink_0.2.1-invalidsig_amd64.changes",
97 "testdata/changes/hardlink_0.2.0_i386.deb",
98 }
99 origProcessedFiles := []string{
100 "testdata/changes/hardlink_0.2.1.dsc",
101 "testdata/changes/hardlink_0.2.1.tar.gz",
102 "testdata/changes/hardlink_0.2.1_amd64.deb",
103 "testdata/changes/hardlink_0.2.1_amd64.buildinfo",
104 "testdata/changes/hardlink_0.2.1_amd64.changes",
105 }
106
107 var expectedProcessedFiles, expectedFailedFiles []string
108
109 for _, path := range origFailedFiles {
110 filename := filepath.Join(s.Dir, filepath.Base(path))
111 _ = utils.CopyFile(path, filename)
112 expectedFailedFiles = append(expectedFailedFiles, filename)
113 }
114
115 for _, path := range origProcessedFiles {
116 filename := filepath.Join(s.Dir, filepath.Base(path))
117 _ = utils.CopyFile(path, filename)
118 expectedProcessedFiles = append(expectedProcessedFiles, filename)
119 }
120
121 changesFiles, failedFiles := CollectChangesFiles([]string{s.Dir}, s.Reporter)
122 c.Check(failedFiles, HasLen, 0)
123
124 processedFiles, failedFiles, err := ImportChangesFiles(
125 append(changesFiles, "testdata/changes/notexistent.changes"),
126 s.Reporter, true, true, false, false, &NullVerifier{},
127 template.Must(template.New("test").Parse("test")), s.progress, s.localRepoCollection, s.packageCollection, s.packagePool, func(database.ReaderWriter) aptly.ChecksumStorage { return s.checksumStorage },
128 nil, nil)
129 c.Assert(err, IsNil)
130 c.Check(failedFiles, DeepEquals, append(expectedFailedFiles, "testdata/changes/notexistent.changes"))
131 c.Check(processedFiles, DeepEquals, expectedProcessedFiles)
132}
133
134func (s *ChangesSuite) TestImportDbgsymWithVersionedSourceField(c *C) {
135 repo := NewLocalRepo("test", "Test Comment")

Callers

nothing calls this directly

Calls 6

CopyFileFunction · 0.92
NewLocalRepoFunction · 0.85
CollectChangesFilesFunction · 0.85
ImportChangesFilesFunction · 0.85
AddMethod · 0.45
CheckMethod · 0.45

Tested by

no test coverage detected