From 3dd1f818e2e004c96f630e0aea77cded1b018b14 Mon Sep 17 00:00:00 2001 From: Sebastian Pipping Date: Mon, 4 Jan 2010 05:48:51 +0100 Subject: Add test suite for format/subpath/category --- layman/tests/external.py | 26 ++++++++++++++++++ .../tests/testfiles/format-subpath-category-1.xml | 28 +++++++++++++++++++ .../tests/testfiles/format-subpath-category-2.xml | 31 ++++++++++++++++++++++ 3 files changed, 85 insertions(+) create mode 100644 layman/tests/testfiles/format-subpath-category-1.xml create mode 100644 layman/tests/testfiles/format-subpath-category-2.xml diff --git a/layman/tests/external.py b/layman/tests/external.py index f88ea43..81ee3cf 100644 --- a/layman/tests/external.py +++ b/layman/tests/external.py @@ -39,5 +39,31 @@ class Unicode(unittest.TestCase): self._overlays_bug(286290) +class FormatSubpathCategory(unittest.TestCase): + def _run(self, number): + config = {} + filename1 = os.path.join(HERE, 'testfiles', + 'format-subpath-category-%d.xml' % number) + + # Read, write, re-read, compare + os1 = Overlays([filename1], config) + filename2 = os.tmpnam() + os1.write(filename2) + os2 = Overlays([filename2], config) + os.unlink(filename2) + self.assertTrue(os1 == os2) + + # Pass original overlays + return os1 + + def test(self): + os1 = self._run(1) + os2 = self._run(2) + + # Same content from old/layman-global.txt + # and new/repositories.xml format? + self.assertTrue(os1 == os2) + + if __name__ == '__main__': unittest.main() diff --git a/layman/tests/testfiles/format-subpath-category-1.xml b/layman/tests/testfiles/format-subpath-category-1.xml new file mode 100644 index 0000000..41ae2a9 --- /dev/null +++ b/layman/tests/testfiles/format-subpath-category-1.xml @@ -0,0 +1,28 @@ + + + + a_desc + + + b_desc + + + c_desc + + diff --git a/layman/tests/testfiles/format-subpath-category-2.xml b/layman/tests/testfiles/format-subpath-category-2.xml new file mode 100644 index 0000000..8b84d2d --- /dev/null +++ b/layman/tests/testfiles/format-subpath-category-2.xml @@ -0,0 +1,31 @@ + + + + + a_name + a_desc + + a_owner@example.org + + http://example.org/a.tar.bz2 + a_cat + + + b_name + b_desc + + b_owner@example.org + + http://example.org/b.tar.gz + b_path + + + c_name + c_desc + + c_owner@example.org + + :pserver:username@example.org:/usr/local/cvs-repository + c_path + + -- cgit v1.2.3-1-g7c22