diff test/test_packager.py @ 495:ca95be9d033a

add tests for determine debian upstream version fix calling determine_upstream_version in determine_package_version update authors
author Bjoern Ricks <bricks@intevation.de>
date Thu, 14 Oct 2010 07:49:50 +0000
parents fb92f3c1b238
children e5b66539f893
line wrap: on
line diff
--- a/test/test_packager.py	Wed Oct 13 16:26:53 2010 +0000
+++ b/test/test_packager.py	Thu Oct 14 07:49:50 2010 +0000
@@ -1,6 +1,7 @@
-# Copyright (C) 2007, 2008, 2009 by Intevation GmbH
+# Copyright (C) 2007-2010 by Intevation GmbH
 # Authors:
 # Bernhard Herzog <bh@intevation.de>
+# Bjoern Ricks    <bjoern.ricks@intevation.de>
 #
 # This program is free software under the GPL (>=v2)
 # Read the file COPYING coming with the software for details.
@@ -371,6 +372,104 @@
         format = srcpkg.get_debian_source_format(pkgbasedir)
         self.assertEqual("1.0", format)
 
+class TestDetermineUpstreamVersion(unittest.TestCase, FileTestMixin):
+
+    def test_debian_upstream_version(self):
+        trackdir = self.create_files("track",
+                                     [("debian",
+                                       [("changelog", """\
+testpkg (1.0.1~-1abc.173) unstable; urgency=low
+
+  * Initial version
+
+ -- TreePKG <treepkg@example.com>  Thu,  8 Mar 2007 18:34:39 +0100
+"""
+                                     )]),
+                                     ("pkg",
+                                       [("704195-0",
+                                         [("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", [])
+                                         ]
+                                        )]
+                                      )]
+                                   )
+        track = PackageTrack("testtrack", trackdir, "", "", "", "", "")
+        revpkg = RevisionPackager(track, 704195, 0)
+        srcpkg = SourcePackager(revpkg)
+
+        pkgbasedir = trackdir
+        version = srcpkg.determine_upstream_version()
+        self.assertEqual("1.0.1~", version)
+
+    def test_debian_native_upstream_version(self):
+        trackdir = self.create_files("track",
+                                     [("debian",
+                                       [("changelog", """\
+testpkg (1.0.1) unstable; urgency=low
+
+  * Initial version
+
+ -- TreePKG <treepkg@example.com>  Thu,  8 Mar 2007 18:34:39 +0100
+"""
+                                     )]),
+                                     ("pkg",
+                                       [("704195-0",
+                                         [("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", [])
+                                         ]
+                                        )]
+                                      )]
+                                   )
+        track = PackageTrack("testtrack", trackdir, "", "", "", "", "")
+        revpkg = RevisionPackager(track, 704195, 0)
+        srcpkg = SourcePackager(revpkg)
+
+        pkgbasedir = trackdir
+        version = srcpkg.determine_upstream_version()
+        self.assertEqual("1.0.1", version)
+
+    def test_debian_epoch_upstream_version(self):
+        trackdir = self.create_files("track",
+                                     [("debian",
+                                       [("changelog", """\
+testpkg (4:1.0.1-1abc3) unstable; urgency=low
+
+  * Initial version
+
+ -- TreePKG <treepkg@example.com>  Thu,  8 Mar 2007 18:34:39 +0100
+"""
+                                     )]),
+                                     ("pkg",
+                                       [("704195-0",
+                                         [("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", [])
+                                         ]
+                                        )]
+                                      )]
+                                   )
+        track = PackageTrack("testtrack", trackdir, "", "", "", "", "")
+        revpkg = RevisionPackager(track, 704195, 0)
+        srcpkg = SourcePackager(revpkg)
+
+        pkgbasedir = trackdir
+        version = srcpkg.determine_upstream_version()
+        self.assertEqual("1.0.1", version)
+
 class TestRevisionPackager(unittest.TestCase, FileTestMixin):
 
     def test_list_source_files(self):
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)