summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2014-11-13 18:33:45 +0200
committerMarkus Lehtonen <markus.lehtonen@linux.intel.com>2014-11-14 14:45:07 +0200
commit85e742216d28b5afd0690c8d229ee49ec9c80c4d (patch)
tree919f8e78d5a801f92cee89ee894a6188d98ecb8c /tests
parent2e5a45346455dee254b68f77d900a227fafeefa8 (diff)
downloadgit-buildpackage-85e742216d28b5afd0690c8d229ee49ec9c80c4d.tar.gz
git-buildpackage-85e742216d28b5afd0690c8d229ee49ec9c80c4d.tar.bz2
git-buildpackage-85e742216d28b5afd0690c8d229ee49ec9c80c4d.zip
tests: add unit tests for gbp.rpm.SrcRpmFile
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/20_test_rpm.py28
-rw-r--r--tests/data/rpm/srpms/gbp-test-1.0-1.src.rpmbin0 -> 3427 bytes
-rw-r--r--tests/data/rpm/srpms/gbp-test-native-1.0-1.src.rpmbin0 -> 2187 bytes
-rw-r--r--tests/data/rpm/srpms/gbp-test-native2-2.0-0.src.rpmbin0 -> 2008 bytes
-rw-r--r--tests/data/rpm/srpms/gbp-test2-3.0-0.src.rpmbin0 -> 3507 bytes
5 files changed, 28 insertions, 0 deletions
diff --git a/tests/20_test_rpm.py b/tests/20_test_rpm.py
index 227a1c68..7125b4c4 100644
--- a/tests/20_test_rpm.py
+++ b/tests/20_test_rpm.py
@@ -58,6 +58,34 @@ class RpmTestBase(object):
"""Test case teardown"""
shutil.rmtree(self.tmpdir)
+class TestSrcRpmFile(RpmTestBase):
+ """Test L{gbp.rpm.SrcRpmFile}"""
+
+ def test_srpm(self):
+ """Test parsing of a source rpm"""
+ srpm = SrcRpmFile(os.path.join(SRPM_DIR, 'gbp-test-1.0-1.src.rpm'))
+ assert srpm.version == {'release': '1', 'upstreamversion': '1.0'}
+ assert srpm.name == 'gbp-test'
+ assert srpm.upstreamversion == '1.0'
+ assert srpm.packager is None
+
+ def test_srpm_2(self):
+ """Test parsing of another source rpm"""
+ srpm = SrcRpmFile(os.path.join(SRPM_DIR, 'gbp-test2-3.0-0.src.rpm'))
+ assert srpm.version == {'release': '0', 'upstreamversion': '3.0',
+ 'epoch': '2'}
+ assert srpm.packager == 'Markus Lehtonen '\
+ '<markus.lehtonen@linux.intel.com>'
+
+ def test_unpack_srpm(self):
+ """Test unpacking of a source rpm"""
+ srpm = SrcRpmFile(os.path.join(SRPM_DIR, 'gbp-test-1.0-1.src.rpm'))
+ srpm.unpack(self.tmpdir)
+ for fn in ['gbp-test-1.0.tar.bz2', 'foo.txt', 'bar.tar.gz', 'my.patch',
+ 'my2.patch', 'my3.patch']:
+ assert os.path.exists(os.path.join(self.tmpdir, fn)), \
+ "%s not found" % fn
+
class TestSpecFile(RpmTestBase):
"""Test L{gbp.rpm.SpecFile}"""
diff --git a/tests/data/rpm/srpms/gbp-test-1.0-1.src.rpm b/tests/data/rpm/srpms/gbp-test-1.0-1.src.rpm
new file mode 100644
index 00000000..74afbd6c
--- /dev/null
+++ b/tests/data/rpm/srpms/gbp-test-1.0-1.src.rpm
Binary files differ
diff --git a/tests/data/rpm/srpms/gbp-test-native-1.0-1.src.rpm b/tests/data/rpm/srpms/gbp-test-native-1.0-1.src.rpm
new file mode 100644
index 00000000..1002aaea
--- /dev/null
+++ b/tests/data/rpm/srpms/gbp-test-native-1.0-1.src.rpm
Binary files differ
diff --git a/tests/data/rpm/srpms/gbp-test-native2-2.0-0.src.rpm b/tests/data/rpm/srpms/gbp-test-native2-2.0-0.src.rpm
new file mode 100644
index 00000000..880b3100
--- /dev/null
+++ b/tests/data/rpm/srpms/gbp-test-native2-2.0-0.src.rpm
Binary files differ
diff --git a/tests/data/rpm/srpms/gbp-test2-3.0-0.src.rpm b/tests/data/rpm/srpms/gbp-test2-3.0-0.src.rpm
new file mode 100644
index 00000000..1cf12c7a
--- /dev/null
+++ b/tests/data/rpm/srpms/gbp-test2-3.0-0.src.rpm
Binary files differ