diff options
author | Joshua Ismael Haase Hernández <hahj87@gmail.com> | 2011-02-08 03:13:39 -0600 |
---|---|---|
committer | Joshua Ismael Haase Hernández <hahj87@gmail.com> | 2011-02-08 03:13:39 -0600 |
commit | 61f5ecfa6b57f31c14430a7de5099640fcbe3525 (patch) | |
tree | ec8404ce8c30ca8c56d5fd004a22f281c0004a56 | |
parent | 3633ea3c4ec93436b2344dba79b06ff00c7ae528 (diff) |
* Updated Package class
* Corrected test1.py -> for get_package_list_from_rsync_output
-rw-r--r-- | config.py | 1 | ||||
-rw-r--r-- | test/test1.py | 22 |
2 files changed, 13 insertions, 10 deletions
@@ -49,6 +49,7 @@ class Package: """ An object that has information about a package. """ package_info={ "name" : False, "version" : False, + "release" : False, "arch" : False, "license" : False, "location": False} diff --git a/test/test1.py b/test/test1.py index 495ba05..db87f51 100644 --- a/test/test1.py +++ b/test/test1.py @@ -14,41 +14,43 @@ import unittest class KnownValues(unittest.TestCase): directory_list=("drwxrwxr-x 15 2010/09/11 11:28:50 community-staging", "drwxrwxr-x 30 2010/09/11 11:28:50 community-staging/os") - # (output, name, version, arch) + # (output, name, version, arch, release, location) link_list=( - ("lrwxrwxrwx 53 2011/01/31 01:52:06 community-testing/os/i686/apvlv-0.1.0-2-i686.pkg.tar.xz -> ../../../pool/community/apvlv-0.1.0-2-i686.pkg.tar.xz", "apvlv","0.1.0","i686"), - ("lrwxrwxrwx 56 2011/02/04 14:34:08 community-testing/os/i686/calibre-0.7.44-2-i686.pkg.tar.xz -> ../../../pool/community/calibre-0.7.44-2-i686.pkg.tar.xz","calibre","0.7.44","i686"), + ("lrwxrwxrwx 53 2011/01/31 01:52:06 community-testing/os/i686/apvlv-0.1.0-2-i686.pkg.tar.xz -> ../../../pool/community/apvlv-0.1.0-2-i686.pkg.tar.xz", "apvlv","0.1.0","i686", "2", "community-testing/os/i686/apvlv-0.1.0-2-i686.pkg.tar.xz"), + ("lrwxrwxrwx 56 2011/02/04 14:34:08 community-testing/os/i686/calibre-0.7.44-2-i686.pkg.tar.xz -> ../../../pool/community/calibre-0.7.44-2-i686.pkg.tar.xz","calibre","0.7.44","i686", "2", "community-testing/os/i686/calibre-0.7.44-2-i686.pkg.tar.xz"), ) package_list=( ("-rw-rw-r-- 5846249 2010/11/13 10:54:25 pool/community/abuse-0.7.1-1-x86_64.pkg.tar.gz", - "abuse","0.7.1","x86_64"), + "abuse","0.7.1","x86_64","1","pool/community/abuse-0.7.1-1-x86_64.pkg.tar.gz"), ("-rw-rw-r-- 982768 2011/02/05 14:38:17 pool/community/acetoneiso2-2.3-2-i686.pkg.tar.xz", - "acetoneiso2","2.3","i686"), + "acetoneiso2","2.3","i686", "2", "pool/community/acetoneiso2-2.3-2-i686.pkg.tar.xz"), ("-rw-rw-r-- 982764 2011/02/05 14:38:40 pool/community/acetoneiso2-2.3-2-x86_64.pkg.tar.xz", - "acetoneiso2","2.3","x86_64") + "acetoneiso2","2.3","x86_64","2","pool/community/acetoneiso2-2.3-2-x86_64.pkg.tar.xz") ) def generate_results(self, example_tuple): a=list() - for output, name, version, arch in example_tuple: + for output, name, version, arch, release, location in example_tuple: pkg=Package() pkg["name"] = name pkg["version"] = version pkg["arch"] = arch + pkg["release"] = release + pkg["location"] = location a.append(pkg) return tuple(a) def testDirectoryOutput(self): """get_file_list_from_rsync_output should ignore directories""" rsync_out="\n".join(self.directory_list) - result=get_file_list_from_rsync_output(output) + result=get_file_list_from_rsync_output(rsync_out) self.assertEqual(tuple(), result) def testLinkOutput(self): """get_file_list_from_rsync_output should make a Package Object from links """ correct_result=self.generate_results(self.link_list) - rsync_out="\n".join([a for a,b,c,d in self.link_list]) + rsync_out="\n".join([a for a,b,c,d,e,f in self.link_list]) result=get_file_list_from_rsync_output(rsync_out) self.assertEqual(correct_result, result) @@ -56,7 +58,7 @@ class KnownValues(unittest.TestCase): """get_file_list_from_rsync_output should make a Package Object from links """ correct_result=self.generate_results(self.package_list) - rsync_out="\n".join([a for a,b,c,d in self.package_list]) + rsync_out="\n".join([a for a,b,c,d,e,f in self.package_list]) result=get_file_list_from_rsync_output(rsync_out) self.assertEqual(correct_result, result) |