summaryrefslogtreecommitdiff
path: root/test/test1.py
diff options
context:
space:
mode:
authorJoshua Ismael Haase Hernández <hahj87@gmail.com>2011-02-08 10:47:55 -0600
committerJoshua Ismael Haase Hernández <hahj87@gmail.com>2011-02-08 10:47:55 -0600
commitdf79a07c092880259a851d4ebf9febe9a8e19880 (patch)
tree4c87473437e36789650a5cc53e0598cfa35537a2 /test/test1.py
parent748ef10d89e5898c1ebffb08165f18cd3829119e (diff)
Fixed test1.py
Diffstat (limited to 'test/test1.py')
-rw-r--r--test/test1.py41
1 files changed, 18 insertions, 23 deletions
diff --git a/test/test1.py b/test/test1.py
index ea488e9..61b0651 100644
--- a/test/test1.py
+++ b/test/test1.py
@@ -26,9 +26,9 @@ class KnownValues(unittest.TestCase):
"acetoneiso2","2.3","x86_64","2","pool/community/acetoneiso2-2.3-2-x86_64.pkg.tar.xz")
)
- def generate_results(self, example_tuple):
- rsync_out="\n".join([a for a,b,c,d,e,f in example_tuple])
- return get_file_list_from_rsync_output(rsync_out)
+ def generate_results(self, example_tuple, attr):
+ rsync_out, name, version, arch, release, location = example_tuple
+ return get_file_list_from_rsync_output(rsync_out)[0][attr], locals()[attr]
def testDirectoryOutput(self):
"""get_file_list_from_rsync_output should ignore directories"""
@@ -37,34 +37,29 @@ class KnownValues(unittest.TestCase):
self.assertEqual(tuple(), result)
def testNames(self):
- results=self.generate_results(self.examples)
- var =[name for rsync_out, name, version, arch, release, location in self.examples]
- for i in range(len(results)):
- self.assertEqual(results[i]["name"], var[i])
+ for i in self.examples:
+ k,v = self.generate_results(example_tuple=i,attr="name")
+ self.assertEqual(k, v)
def testVersions(self):
- results=self.generate_results(self.examples)
- var = [version for rsync_out, name, version, arch, release, location in self.examples]
- for i in range(len(results)):
- self.assertEqual(results[i]["version"], var[i])
+ for i in self.examples:
+ k,v = self.generate_results(example_tuple=i,attr="version")
+ self.assertEqual(k, v)
def testArchs(self):
- results=self.generate_results(self.examples)
- var = [arch for rsync_out, name, version, arch, release, location in self.examples]
- for i in range(len(results)):
- self.assertEqual(results[i]["arch"], var[i])
+ for i in self.examples:
+ k,v = self.generate_results(example_tuple=i,attr="arch")
+ self.assertEqual(k, v)
def testReleases(self):
- results=self.generate_results(self.examples)
- var = [release for rsync_out, name, version, arch, release, location in self.examples]
- for i in range(len(results)):
- self.assertEqual(results[i]["release"], var[i])
+ for i in self.examples:
+ k,v = self.generate_results(example_tuple=i,attr="release")
+ self.assertEqual(k, v)
def testLocations(self):
- results=self.generate_results(self.examples)
- var = [location for rsync_out, name, version, arch, release, location in self.examples]
- for i in range(len(results)):
- self.assertEqual(results[i]["location"], var[i])
+ for i in self.examples:
+ k,v = self.generate_results(example_tuple=i,attr="location")
+ self.assertEqual(k, v)
if __name__ == "__main__":
unittest.main()