[csw-devel] SF.net SVN: gar:[16843] csw/mgar/gar/v2/lib/python/csw_upload_pkg_test.py
wahwah at users.sourceforge.net
wahwah at users.sourceforge.net
Fri Jan 20 10:44:41 CET 2012
Revision: 16843
http://gar.svn.sourceforge.net/gar/?rev=16843&view=rev
Author: wahwah
Date: 2012-01-20 09:44:41 +0000 (Fri, 20 Jan 2012)
Log Message:
-----------
csw-upload-pkg: Add a unit test with a 5.8 pkg
Added during debugging of another issue, saving here for completeness.
Modified Paths:
--------------
csw/mgar/gar/v2/lib/python/csw_upload_pkg_test.py
Modified: csw/mgar/gar/v2/lib/python/csw_upload_pkg_test.py
===================================================================
--- csw/mgar/gar/v2/lib/python/csw_upload_pkg_test.py 2012-01-20 09:44:11 UTC (rev 16842)
+++ csw/mgar/gar/v2/lib/python/csw_upload_pkg_test.py 2012-01-20 09:44:41 UTC (rev 16843)
@@ -11,6 +11,21 @@
import rest
import copy
+GDB_STRUCT_8 = {
+ "arch": "sparc",
+ "basename": "gdb-7.2,REV=2011.01.21-SunOS5.8-sparc-CSW.pkg.gz",
+ "catalogname": "gdb",
+ "filename_arch": "sparc",
+ "maintainer_email": "pfele... at opencsw.org",
+ "maintainer_full_name": None,
+ "md5_sum": "7971e31461b53638d7813407fab4765b",
+ "mtime": "2011-01-24 03:09:54",
+ "osrel": "SunOS5.8",
+ "pkgname": "CSWgdb",
+ "rev": "2011.01.21",
+ "size": 7616184,
+ "version_string": "7.2,REV=2011.01.21",
+}
GDB_STRUCT_9 = {
"arch": "sparc",
"basename": "gdb-7.2,REV=2011.01.21-SunOS5.9-sparc-CSW.pkg.gz",
@@ -253,7 +268,30 @@
)
self.assertEquals(expected, result)
+ def test_MatchSrv4ToCatalogsSolaris8(self):
+ rest_client_mock = self.mox.CreateMock(rest.RestClient)
+ self.mox.StubOutWithMock(rest, "RestClient")
+ rest.RestClient(None).AndReturn(rest_client_mock)
+ rest_client_mock.Srv4ByCatalogAndCatalogname(
+ 'unstable', 'sparc', u'SunOS5.9', 'gdb').AndReturn(GDB_STRUCT_8)
+ rest_client_mock.Srv4ByCatalogAndCatalogname(
+ 'unstable', 'sparc', u'SunOS5.10', 'gdb').AndReturn(GDB_STRUCT_8)
+ rest_client_mock.Srv4ByCatalogAndCatalogname(
+ 'unstable', 'sparc', u'SunOS5.11', 'gdb').AndReturn(GDB_STRUCT_8)
+ self.mox.ReplayAll()
+ su = csw_upload_pkg.Srv4Uploader(None, None)
+ result = su._MatchSrv4ToCatalogs(
+ "gdb-7.2,REV=2011.01.21-SunOS5.9-sparc-CSW.pkg.gz",
+ "unstable", "sparc", "SunOS5.9",
+ "deadbeef61b53638d7813407fab4765b")
+ expected = (
+ ("unstable", "sparc", "SunOS5.9"),
+ ("unstable", "sparc", "SunOS5.10"),
+ ("unstable", "sparc", "SunOS5.11"),
+ )
+ self.assertEquals(expected, result)
+
class Srv4UploaderDataDrivenUnitTest(mox.MoxTestBase):
"""A unit test doing an search over multiple combinations.
@@ -268,6 +306,7 @@
((None, None, None), 9, None, (9, 10, 11)),
((None, None, 9), 9, None, (9, 10, 11)),
((None, 9, 9), 9, None, (9, 10, 11)),
+ (( 8, 8, 8), 9, None, (9, 10, 11)), # No insertion to 5.8
(( 9, 9, 9), 9, None, (9, 10, 11)),
((None, 9, 10), 9, None, (9, 10)),
(( 9, 9, 10), 9, None, (9, 10)),
@@ -294,6 +333,7 @@
def DataPointTest(self, in_catalog, pkg_osrel, osrel_spec, expected_rels):
pkg_struct_map = {
None: None,
+ 8: GDB_STRUCT_8,
9: GDB_STRUCT_9,
10: GDB_STRUCT_10,
11: GDB_STRUCT_11,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the devel
mailing list