[csw-devel] SF.net SVN: gar:[21085] csw/mgar/gar/v2/lib/python/ generate_catalog_file_test.py
wahwah at users.sourceforge.net
wahwah at users.sourceforge.net
Tue May 14 22:59:53 CEST 2013
Revision: 21085
http://gar.svn.sourceforge.net/gar/?rev=21085&view=rev
Author: wahwah
Date: 2013-05-14 20:59:53 +0000 (Tue, 14 May 2013)
Log Message:
-----------
generate-catalog-file: Unit test cleanup
Modified Paths:
--------------
csw/mgar/gar/v2/lib/python/generate_catalog_file_test.py
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 20:59:42 UTC (rev 21084)
+++ csw/mgar/gar/v2/lib/python/generate_catalog_file_test.py 2013-05-14 20:59:53 UTC (rev 21085)
@@ -1,13 +1,14 @@
#!/usr/bin/env python
+import __builtin__
import datetime
-import unittest
+import io
import mox
-import generate_catalog_file
import rest
-import __builtin__
-import io
+import unittest2 as unittest
+from lib.python import generate_catalog_file
+
PKG_DATA_1 = {
"basename": "389_admin-1.1.29,REV=2012.05.02-SunOS5.10-sparc-CSW.pkg.gz",
"catalogname": "389_admin",
@@ -35,7 +36,7 @@
"fdb7912713da36afcbbe52266c15cb3f 395802 CSWfoo|CSWbar "
"none none")
-class CatalogFileGeneratorUnitTest(mox.MoxTestBase):
+class CatalogFileGeneratorUnitTest(mox.MoxTestBase, unittest.TestCase):
def testComposeCatalogLineBasic(self):
mock_pkgcache = self.mox.CreateMock(rest.CachedPkgstats)
@@ -87,7 +88,7 @@
mock_rest.GetCatalog('dublin', 'sparc', 'SunOS5.10').AndReturn([PKG_DATA_1])
md5_sum = 'fdb7912713da36afcbbe52266c15cb3f'
mock_rest.GetCatalogData(md5_sum).AndReturn(FAKE_CATALOG_DATA)
- fake_file = io.BytesIO();
+ fake_file = io.BytesIO()
open('fake-dir/catalog', 'w').AndReturn(fake_file)
self.mox.ReplayAll()
cfg.GenerateCatalog('fake-dir')
@@ -103,7 +104,7 @@
md5_sum = 'fdb7912713da36afcbbe52266c15cb3f'
mock_pkgcache.GetDeps(md5_sum).AndReturn(FAKE_CATALOG_DATA)
mock_rest.GetCatalog('dublin', 'sparc', 'SunOS5.10').AndReturn([PKG_DATA_1])
- fake_file = io.BytesIO();
+ fake_file = io.BytesIO()
open('fake-dir/descriptions', 'w').AndReturn(fake_file)
self.mox.ReplayAll()
cfg.GenerateDescriptions('fake-dir')
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