comparison test/test_packager.py @ 88:3ae54f99db26

Add methods RevisionPackager.list_source_files and RevisionPackager.list_binary_files to list the binary and source files of a revision. Also add corresponding tests.
author Bernhard Herzog <bh@intevation.de>
date Tue, 11 Sep 2007 13:46:53 +0000
parents 08d8ffd40f27
children 3ed079a7174a
comparison
equal deleted inserted replaced
87:08d8ffd40f27 88:3ae54f99db26
170 [("status", ""), 170 [("status", ""),
171 ("src", []), 171 ("src", []),
172 ("binary", [])])])]) 172 ("binary", [])])])])
173 track = PackageTrack("testtrack", self.trackdir, "", "", "", "", "") 173 track = PackageTrack("testtrack", self.trackdir, "", "", "", "", "")
174 self.assertEquals(track.last_packaged_revision(), 704195) 174 self.assertEquals(track.last_packaged_revision(), 704195)
175
176
177 class TestRevisionPackager(unittest.TestCase, FileTestMixin):
178
179 def setUp(self):
180 self.trackdir = self.create_temp_dir(self.id() + "-track")
181
182 def test_list_source_files(self):
183 # Note: The revisions in the pkg dir are not ordered so that we
184 # can check whether get_revision_numbers returns a sorted list
185 # of revisions
186 self.create_files(self.trackdir,
187 [("pkg",
188 [("704195-1",
189 [("status",
190 ("TreePackagerStatus 0.0\n"
191 "status: binary_package_created\n"
192 "start: 2007-09-10 17:16:48\n"
193 "stop: 2007-09-11 00:07:36\n")),
194 ("src", [("test_1.0.orig.tar.gz", ""),
195 ("test_1.0-1.diff.gz", ""),
196 ("test_1.0-1.dsc", "")]),
197 ("binary", [])]),
198 ("702432-1",
199 [("status", ""),
200 ("src", []),
201 ("binary", [])])])])
202 track = PackageTrack("testtrack", self.trackdir, "", "", "", "", "")
203 revpkg = RevisionPackager(track, 704195)
204 srcdir = os.path.join(self.trackdir, "pkg", "704195-1", "src")
205 self.assertEquals(revpkg.list_source_files(),
206 [os.path.join(srcdir, filename)
207 for filename in ["test_1.0-1.diff.gz",
208 "test_1.0-1.dsc",
209 "test_1.0.orig.tar.gz"]])
210
211 def test_list_binary_files(self):
212 # Note: The revisions in the pkg dir are not ordered so that we
213 # can check whether get_revision_numbers returns a sorted list
214 # of revisions
215 self.create_files(self.trackdir,
216 [("pkg",
217 [("704195-1",
218 [("status",
219 ("TreePackagerStatus 0.0\n"
220 "status: binary_package_created\n"
221 "start: 2007-09-10 17:16:48\n"
222 "stop: 2007-09-11 00:07:36\n")),
223 ("src", []),
224 ("binary", [("test_1.0-1_i386.deb", ""),
225 ("test_1.0-1_i386.changes", "")])]),
226 ("702432-1",
227 [("status", ""),
228 ("src", []),
229 ("binary", [])])])])
230 track = PackageTrack("testtrack", self.trackdir, "", "", "", "", "")
231 revpkg = RevisionPackager(track, 704195)
232 srcdir = os.path.join(self.trackdir, "pkg", "704195-1", "binary")
233 self.assertEquals(revpkg.list_binary_files(),
234 [os.path.join(srcdir, filename)
235 for filename in ["test_1.0-1_i386.changes",
236 "test_1.0-1_i386.deb"]])
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)