[csw-devel] SF.net SVN: gar:[21083] csw/mgar/gar/v2/lib/python

dmichelsen at users.sourceforge.net dmichelsen at users.sourceforge.net
Tue May 14 22:42:56 CEST 2013


Revision: 21083
          http://gar.svn.sourceforge.net/gar/?rev=21083&view=rev
Author:   dmichelsen
Date:     2013-05-14 20:42:55 +0000 (Tue, 14 May 2013)
Log Message:
-----------
mGAR v2: Catalog generation CREATIONDATE fixes

Modified Paths:
--------------
    csw/mgar/gar/v2/lib/python/generate_catalog_file.py
    csw/mgar/gar/v2/lib/python/generate_catalog_file_test.py

Modified: csw/mgar/gar/v2/lib/python/generate_catalog_file.py
===================================================================
--- csw/mgar/gar/v2/lib/python/generate_catalog_file.py	2013-05-14 19:52:34 UTC (rev 21082)
+++ csw/mgar/gar/v2/lib/python/generate_catalog_file.py	2013-05-14 20:42:55 UTC (rev 21083)
@@ -26,7 +26,7 @@
 import optparse
 import logging
 import sys
-from datetime import datetime
+import datetime
 
 
 class Error(Exception):
@@ -88,7 +88,7 @@
   def _GenerateCatalogAsLines(self):
     """Return the complete catalog as a list of lines."""
     lines = []
-    lines.append("# CREATIONDATE " + datetime.now().isoformat() + "Z")
+    lines.append("# CREATIONDATE " + datetime.datetime.utcnow().replace(microsecond=0).isoformat() + "Z")
 
     # Potential additional lines might go here.
     # lines.append("...")

Modified: csw/mgar/gar/v2/lib/python/generate_catalog_file_test.py
===================================================================
--- csw/mgar/gar/v2/lib/python/generate_catalog_file_test.py	2013-05-14 19:52:34 UTC (rev 21082)
+++ csw/mgar/gar/v2/lib/python/generate_catalog_file_test.py	2013-05-14 20:42:55 UTC (rev 21083)
@@ -1,5 +1,6 @@
 #!/usr/bin/env python
 
+import datetime
 import unittest
 import mox
 import generate_catalog_file
@@ -29,6 +30,7 @@
     "pkgname": "CSW389-admin-mock",
 }
 
+#EXPECTED_LINE = (["# CREATIONDATE 2013-04-01T11:11:11Z",
 EXPECTED_LINE = ("389_admin 1.1.29,REV=2012.05.02 CSW389-admin-mock "
                  "389_admin-1.1.29,REV=2012.05.02-SunOS5.10-sparc-CSW.pkg.gz "
                  "fdb7912713da36afcbbe52266c15cb3f 395802 CSWfoo|CSWbar "
@@ -58,6 +60,9 @@
   def testGenerateCatalogAsLines(self):
     mock_pkgcache = self.mox.CreateMock(rest.CachedPkgstats)
     mock_rest = self.mox.CreateMock(rest.RestClient)
+    self.mox.StubOutWithMock(datetime, 'datetime')
+    datetime.datetime.utcnow().AndReturn(datetime.datetime(year=2013, month=4, day=1, hour=11, minute=11, second=11));
+    self.mox.ReplayAll()
     cfg = generate_catalog_file.CatalogFileGenerator("dublin",
                                                      "sparc",
                                                      "SunOS5.10",

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