summaryrefslogtreecommitdiffstats
path: root/layman
diff options
context:
space:
mode:
authorSebastian Pipping <sebastian@pipping.org>2010-01-04 05:48:51 +0100
committerSebastian Pipping <sebastian@pipping.org>2010-01-04 05:51:42 +0100
commit3dd1f818e2e004c96f630e0aea77cded1b018b14 (patch)
tree37f3ed41e0b4e3593611cabeffbee0dab603c872 /layman
parente54bec19b0a5e29df79b35d0f90574e22db538da (diff)
downloadlayman-3dd1f818e2e004c96f630e0aea77cded1b018b14.tar.gz
layman-3dd1f818e2e004c96f630e0aea77cded1b018b14.tar.bz2
layman-3dd1f818e2e004c96f630e0aea77cded1b018b14.zip
Add test suite for format/subpath/category
Diffstat (limited to 'layman')
-rw-r--r--layman/tests/external.py26
-rw-r--r--layman/tests/testfiles/format-subpath-category-1.xml28
-rw-r--r--layman/tests/testfiles/format-subpath-category-2.xml31
3 files changed, 85 insertions, 0 deletions
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<layman>
+ <overlay
+ name="a_name"
+ contact="a_owner@example.org"
+ type="tar"
+ src="http://example.org/a.tar.bz2"
+ format="bz2"
+ category="a_cat">
+ <description>a_desc</description>
+ </overlay>
+ <overlay
+ name="b_name"
+ contact="b_owner@example.org"
+ type="tar"
+ src="http://example.org/b.tar.gz"
+ subpath="b_path">
+ <description>b_desc</description>
+ </overlay>
+ <overlay
+ name="c_name"
+ contact="c_owner@example.org"
+ type="cvs"
+ src=":pserver:username@example.org:/usr/local/cvs-repository"
+ subpath="c_path">
+ <description>c_desc</description>
+ </overlay>
+</layman>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE repositories SYSTEM "/dtd/repositories.dtd">
+<repositories xmlns="" version="1.0">
+ <repo>
+ <name>a_name</name>
+ <description>a_desc</description>
+ <owner>
+ <email>a_owner@example.org</email>
+ </owner>
+ <source type="tar" format="bz2">http://example.org/a.tar.bz2</source>
+ <category>a_cat</category>
+ </repo>
+ <repo>
+ <name>b_name</name>
+ <description>b_desc</description>
+ <owner>
+ <email>b_owner@example.org</email>
+ </owner>
+ <source type="tar">http://example.org/b.tar.gz</source>
+ <subpath>b_path</subpath>
+ </repo>
+ <repo>
+ <name>c_name</name>
+ <description>c_desc</description>
+ <owner>
+ <email>c_owner@example.org</email>
+ </owner>
+ <source type="cvs">:pserver:username@example.org:/usr/local/cvs-repository</source>
+ <subpath>c_path</subpath>
+ </repo>
+</repositories>