aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2011-11-25 15:51:52 +0100
committerGuido Günther <agx@sigxcpu.org>2011-11-28 22:29:48 +0100
commitc9a1595a666cc83f9e9e523f0b4f27502f61b998 (patch)
tree83334959f3559d8836d8caecc5db7205b795a3bf /tests
parentf7a6b073a43e144d43550e92fc111d456c8bc973 (diff)
Add ChangeLog class
making it easier to query versions. Add tests.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_Changelog.py158
1 files changed, 158 insertions, 0 deletions
diff --git a/tests/test_Changelog.py b/tests/test_Changelog.py
new file mode 100644
index 00000000..c4c7c0cb
--- /dev/null
+++ b/tests/test_Changelog.py
@@ -0,0 +1,158 @@
+# vim: set fileencoding=utf-8 :
+
+"""
+Test L{gbp.deb.changelog.ChangeLog}
+"""
+
+cl_debian = """git-buildpackage (0.5.32) unstable; urgency=low
+
+ * [efe9220] Use known_compressions in guess_upstream_version too
+ (Closes: #645477)
+ * [e984baf] git-import-orig: fix --filter
+
+ -- Guido Günther <agx@sigxcpu.org> Mon, 17 Oct 2011 10:15:22 +0200
+
+git-buildpackage (0.5.31) unstable; urgency=low
+
+ [ Guido Günther ]
+ * [3588d88] Fix pristine-tar error message
+ * [8da98da] gbp-pq: don't fail on missing series file but create an empty
+ branch instead
+
+ [ Salvatore Bonaccorso ]
+ * [b33cf74] Fix URL to cl2vcs service.
+ Refer to https://honk.sigxcpu.org/cl2vcs instead of
+ https://honk.sigxcpu.org/cl2vcs for the cl2vcs service. (Closes: #640141)
+
+ -- Guido Günther <agx@sigxcpu.org> Wed, 28 Sep 2011 20:21:34 +0200
+"""
+
+cl_upstream="""python-dateutil (1.0-1) unstable; urgency=low
+
+ * Initial release (Closes: #386256)
+
+ -- Guido Günther <agx@sigxcpu.org> Wed, 6 Sep 2006 10:33:06 +0200
+"""
+
+cl_epoch="""xserver-xorg-video-nv (1:1.2.0-3) unstable; urgency=low
+
+ [ Steve Langasek ]
+ * Upload to unstable
+
+ -- David Nusinow <dnusinow@debian.org> Mon, 18 Sep 2006 19:57:45 -0400
+"""
+
+
+def test_parse_debian_only():
+ """
+ Parse a the changelog of debian only package
+
+ Methods tested:
+ - L{gbp.deb.changelog.ChangeLog.__init__}
+ - L{gbp.deb.changelog.ChangeLog.is_native}
+
+ Properties tested:
+ - L{gbp.deb.changelog.ChangeLog.version}
+ - L{gbp.deb.changelog.ChangeLog.debian_version}
+ - L{gbp.deb.changelog.ChangeLog.upstream_version}
+ - L{gbp.deb.changelog.ChangeLog.epoch}
+ - L{gbp.deb.changelog.ChangeLog.noepoch}
+
+ >>> import gbp.deb.changelog
+ >>> cl = gbp.deb.changelog.ChangeLog(cl_debian)
+ >>> cl.version
+ '0.5.32'
+ >>> cl.version == cl['Version']
+ True
+ >>> cl.debian_version
+ '0.5.32'
+ >>> cl.debian_version == cl['Debian-Version']
+ True
+ >>> cl.noepoch
+ '0.5.32'
+ >>> cl.noepoch == cl['NoEpoch-Version']
+ True
+ >>> cl.epoch
+ >>> cl.upstream_version
+ >>> cl.is_native()
+ True
+ """
+
+def test_parse_no_eopch():
+ """
+ Parse a the changelog of a package without eopch
+
+ Methods tested:
+ - L{gbp.deb.changelog.ChangeLog.__init__}
+ - L{gbp.deb.changelog.ChangeLog.has_epoch}
+ - L{gbp.deb.changelog.ChangeLog.is_native}
+
+ Properties tested:
+ - L{gbp.deb.changelog.ChangeLog.version}
+ - L{gbp.deb.changelog.ChangeLog.debian_version}
+ - L{gbp.deb.changelog.ChangeLog.upstream_version}
+ - L{gbp.deb.changelog.ChangeLog.epoch}
+ - L{gbp.deb.changelog.ChangeLog.noepoch}
+
+ >>> import gbp.deb.changelog
+ >>> cl = gbp.deb.changelog.ChangeLog(cl_upstream)
+ >>> cl.version
+ '1.0-1'
+ >>> cl.version == cl['Version']
+ True
+ >>> cl.debian_version
+ '1'
+ >>> cl.debian_version == cl['Debian-Version']
+ True
+ >>> cl.noepoch
+ '1.0-1'
+ >>> cl.noepoch == cl['NoEpoch-Version']
+ True
+ >>> cl.epoch
+ >>> cl.upstream_version
+ '1.0'
+ >>> cl.has_epoch()
+ False
+ >>> cl.is_native()
+ False
+ """
+
+def test_parse_eopch():
+ """
+ Parse a the changelog of a package without eopch
+
+ Methods tested:
+ - L{gbp.deb.changelog.ChangeLog.__init__}
+ - L{gbp.deb.changelog.ChangeLog.has_epoch}
+ - L{gbp.deb.changelog.ChangeLog.is_native}
+
+ Properties tested:
+ - L{gbp.deb.changelog.ChangeLog.version}
+ - L{gbp.deb.changelog.ChangeLog.debian_version}
+ - L{gbp.deb.changelog.ChangeLog.upstream_version}
+ - L{gbp.deb.changelog.ChangeLog.epoch}
+ - L{gbp.deb.changelog.ChangeLog.noepoch}
+
+ >>> import gbp.deb.changelog
+ >>> cl = gbp.deb.changelog.ChangeLog(cl_epoch)
+ >>> cl.version
+ '1:1.2.0-3'
+ >>> cl.version == cl['Version']
+ True
+ >>> cl.debian_version
+ '3'
+ >>> cl.debian_version == cl['Debian-Version']
+ True
+ >>> cl.noepoch
+ '1.2.0-3'
+ >>> cl.noepoch == cl['NoEpoch-Version']
+ True
+ >>> cl.epoch
+ '1'
+ >>> cl.upstream_version
+ '1.2.0'
+ >>> cl.has_epoch()
+ True
+ >>> cl.is_native()
+ False
+ """