diff 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
line wrap: on
line diff
--- a/test/test_packager.py	Tue Sep 11 10:05:15 2007 +0000
+++ b/test/test_packager.py	Tue Sep 11 13:46:53 2007 +0000
@@ -172,3 +172,65 @@
                                ("binary", [])])])])
         track = PackageTrack("testtrack", self.trackdir, "", "", "", "", "")
         self.assertEquals(track.last_packaged_revision(), 704195)
+
+
+class TestRevisionPackager(unittest.TestCase, FileTestMixin):
+
+    def setUp(self):
+        self.trackdir = self.create_temp_dir(self.id() + "-track")
+
+    def test_list_source_files(self):
+        # Note: The revisions in the pkg dir are not ordered so that we
+        # can check whether get_revision_numbers returns a sorted list
+        # of revisions
+        self.create_files(self.trackdir,
+                          [("pkg",
+                            [("704195-1",
+                              [("status",
+                                ("TreePackagerStatus 0.0\n"
+                                 "status: binary_package_created\n"
+                                 "start: 2007-09-10 17:16:48\n"
+                                 "stop: 2007-09-11 00:07:36\n")),
+                               ("src", [("test_1.0.orig.tar.gz", ""),
+                                        ("test_1.0-1.diff.gz", ""),
+                                        ("test_1.0-1.dsc", "")]),
+                               ("binary", [])]),
+                             ("702432-1",
+                              [("status", ""),
+                               ("src", []),
+                               ("binary", [])])])])
+        track = PackageTrack("testtrack", self.trackdir, "", "", "", "", "")
+        revpkg = RevisionPackager(track, 704195)
+        srcdir = os.path.join(self.trackdir, "pkg", "704195-1", "src")
+        self.assertEquals(revpkg.list_source_files(),
+                          [os.path.join(srcdir, filename)
+                           for filename in ["test_1.0-1.diff.gz",
+                                            "test_1.0-1.dsc",
+                                            "test_1.0.orig.tar.gz"]])
+
+    def test_list_binary_files(self):
+        # Note: The revisions in the pkg dir are not ordered so that we
+        # can check whether get_revision_numbers returns a sorted list
+        # of revisions
+        self.create_files(self.trackdir,
+                          [("pkg",
+                            [("704195-1",
+                              [("status",
+                                ("TreePackagerStatus 0.0\n"
+                                 "status: binary_package_created\n"
+                                 "start: 2007-09-10 17:16:48\n"
+                                 "stop: 2007-09-11 00:07:36\n")),
+                               ("src", []),
+                               ("binary", [("test_1.0-1_i386.deb", ""),
+                                           ("test_1.0-1_i386.changes", "")])]),
+                             ("702432-1",
+                              [("status", ""),
+                               ("src", []),
+                               ("binary", [])])])])
+        track = PackageTrack("testtrack", self.trackdir, "", "", "", "", "")
+        revpkg = RevisionPackager(track, 704195)
+        srcdir = os.path.join(self.trackdir, "pkg", "704195-1", "binary")
+        self.assertEquals(revpkg.list_binary_files(),
+                          [os.path.join(srcdir, filename)
+                           for filename in ["test_1.0-1_i386.changes",
+                                            "test_1.0-1_i386.deb"]])
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)