[csw-devel] SF.net SVN: gar:[9408] csw/mgar/gar/v2/lib/python
bdwalton at users.sourceforge.net
bdwalton at users.sourceforge.net
Sun Mar 28 14:04:52 CEST 2010
Revision: 9408
http://gar.svn.sourceforge.net/gar/?rev=9408&view=rev
Author: bdwalton
Date: 2010-03-28 12:04:52 +0000 (Sun, 28 Mar 2010)
Log Message:
-----------
gar: checkpkg: add test to catch invalid vendor urls in pkginfo
Modified Paths:
--------------
csw/mgar/gar/v2/lib/python/package_checks.py
csw/mgar/gar/v2/lib/python/package_checks_test.py
Modified: csw/mgar/gar/v2/lib/python/package_checks.py
===================================================================
--- csw/mgar/gar/v2/lib/python/package_checks.py 2010-03-28 11:32:00 UTC (rev 9407)
+++ csw/mgar/gar/v2/lib/python/package_checks.py 2010-03-28 12:04:52 UTC (rev 9408)
@@ -130,6 +130,11 @@
error_mgr.ReportError("pkginfo-description-not-starting-with-uppercase",
desc)
+def CheckVendorURL(pkg_data, error_mgr, logger):
+ vendorurl = pkg_data["pkginfo"]["VENDOR"].split(" ")[0]
+ vendorurl_re = r"^(http|ftp)\://.+\..+$"
+ if not re.match(vendorurl_re, vendorurl):
+ error_mgr.ReportError("pkginfo-bad-vendorurl", vendorurl, "Solution: add VENDOR_URL to GAR Recipe")
def CheckCatalogname(pkg_data, error_mgr, logger):
pkginfo = pkg_data["pkginfo"]
Modified: csw/mgar/gar/v2/lib/python/package_checks_test.py
===================================================================
--- csw/mgar/gar/v2/lib/python/package_checks_test.py 2010-03-28 11:32:00 UTC (rev 9407)
+++ csw/mgar/gar/v2/lib/python/package_checks_test.py 2010-03-28 12:04:52 UTC (rev 9408)
@@ -418,5 +418,25 @@
self.pkg_data = [self.pkg_data]
+class TestCheckVendorURL_BadUrl(CheckpkgUnitTestHelper, unittest.TestCase):
+ FUNCTION_NAME = "CheckVendorURL"
+ def CheckpkgTest(self):
+ # Injecting the data to be examined.
+ self.pkg_data["pkginfo"]["VENDOR"] = "badurl"
+ # Expecting the following method to be called.
+ self.error_mgr_mock.ReportError(
+ "pkginfo-bad-vendorurl",
+ "badurl",
+ "Solution: add VENDOR_URL to GAR Recipe")
+
+
+class TestCheckVendorURL_Good(CheckpkgUnitTestHelper, unittest.TestCase):
+ FUNCTION_NAME = "CheckVendorURL"
+ def CheckpkgTest(self):
+ self.pkg_data["pkginfo"]["VENDOR"] = "http://www.example.com/"
+ # No call to error_mgr_mock means that no errors should be reported: the
+ # URL is okay.
+
+
if __name__ == '__main__':
unittest.main()
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