Index: /gip/trunk/test/test_topology.py =================================================================== --- /gip/trunk/test/test_topology.py (revision 2135) +++ /gip/trunk/test/test_topology.py (revision 2783) @@ -12,8 +12,13 @@ def setUp(self): - self.cp = config("test/test_configs/red.conf") + filename = 'test/test_configs/red.conf' + if not os.path.exists(filename): + filename = 'test_configs/red.conf' + self.filename = filename + self.cp = config(filename) def setUpLDAP(self, multi=False): - command = "$GIP_LOCATION/providers/site_topology.py" + command = "$GIP_LOCATION/providers/site_topology.py --config=%s" % \ + self.filename stdout = os.popen(command) entries = read_ldap(stdout, multi=multi) @@ -21,5 +26,6 @@ def test_exitcode(self): - command = "$GIP_LOCATION/providers/site_topology.py" + command = "$GIP_LOCATION/providers/site_topology.py --config=%s" % \ + self.filename stdout = os.popen(command) stdout.read() Index: /gip/trunk/test/test_gip_common.py =================================================================== --- /gip/trunk/test/test_gip_common.py (revision 2676) +++ /gip/trunk/test/test_gip_common.py (revision 2783) @@ -3,15 +3,16 @@ import os import sys -import gip_sets as sets import unittest import tempfile import ConfigParser -from gip_sets import Set sys.path.append(os.path.expandvars("$GIP_LOCATION/lib/python")) +from gip_sets import Set +import gip_sets as sets from gip_common import config, cp_getBoolean, voList from gip_cluster import getOSGVersion, getApplications from gip_testing import runTest, streamHandler import gip_testing +import gip_osg fermigrid_vos = sets.Set(['osg', 'cdms', 'lqcd', 'auger', 'i2u2', 'cdf', 'des', @@ -63,4 +64,36 @@ os.environ['GIP_LOCATION'] = old_gip_location + def test_osg_check(self): + """ + Make sure that the checkOsgConfigured function operates as desired. + """ + cp = config() + try: + import tempfile + file = tempfile.NamedTemporaryFile() + filename = file.name + except: + filename = '/tmp/osg_check' + file = open(filename, 'w') + if not cp.has_section("gip"): + cp.add_section("gip") + cp.set("gip", "osg_attributes", filename) + try: + file.write('hello world!\n') + didFail = False + try: + gip_osg.checkOsgConfigured(cp) + except: + didFail = True + self.failIf(didFail, "Failed on a 'valid' osg-attributes.conf") + os.unlink(filename) + didFail = False + try: + gip_osg.checkOsgConfigured(cp) + except: + didFail = True + self.failUnless(didFail, "Did not fail on missing file.") + finally: + pass def test_voList(self): """