Exemplo n.º 1
0
 def setUp(self):
     self.testdir = os.getcwd()
     self.confdir = 'fixtures/factory/work-dir'
     os.system('git checkout %s' % self.confdir)
     os.chdir(self.confdir)
     self.factory_config = FactoryConfig()
     self.entry_config = EntryConfigFile('el6_osg34', 'attributes.cfg')
     self.job_descript = JobDescript(self.entry_config.entry_name)
     self.job_attrs = JobAttributes(self.entry_config.entry_name)
     self.job_params = JobParams(self.entry_config.entry_name)
     self.glidein_descript = GlideinDescript()
     self.frontend_descript = FrontendDescript()
     self.signatures = SignatureFile()
     os.chdir(self.testdir)
 def setUp(self):
     self.testdir = os.getcwd()
     self.confdir = 'fixtures/factory/work-dir'
     os.system('git checkout %s' % self.confdir)
     os.chdir(self.confdir)
     self.factory_config = FactoryConfig()
     self.entry_config = EntryConfigFile('el6_osg34', 'attributes.cfg')
     self.job_descript = JobDescript(self.entry_config.entry_name)
     self.job_attrs = JobAttributes(self.entry_config.entry_name)
     self.job_params = JobParams(self.entry_config.entry_name)
     self.glidein_descript = GlideinDescript()
     self.frontend_descript = FrontendDescript()
     self.signatures = SignatureFile()
     os.chdir(self.testdir)
Exemplo n.º 3
0
    def setUp(self):
        self.testdir = os.getcwd()
        self.datadir = 'fixtures/factory/work-dir'
        os.system('git checkout %s' % self.datadir)
        self.startup_dir = os.path.join(self.testdir, self.datadir)
        self.entry_name = 'el6_osg34'
        os.chdir(self.datadir)
        self.monitorDir = os.path.join(self.startup_dir,'monitor/entry_%s' % self.entry_name)
        try:
            os.makedirs(self.monitorDir)
        except Exception:
            pass
        self.glidein_descript = GlideinDescript()
        self.frontend_descript = FrontendDescript()
        glideinwms.factory.glideFactoryEntry.logSupport.log = FakeLogger()

        self.entry = Entry(self.entry_name, self.startup_dir,
                           self.glidein_descript, self.frontend_descript)
        os.chdir(self.testdir)
class TestFactoryConfig(unittest.TestCase):

    def setUp(self):
        self.testdir = os.getcwd()
        self.confdir = 'fixtures/factory/work-dir'
        os.system('git checkout %s' % self.confdir)
        os.chdir(self.confdir)
        self.factory_config = FactoryConfig()
        self.entry_config = EntryConfigFile('el6_osg34', 'attributes.cfg')
        self.job_descript = JobDescript(self.entry_config.entry_name)
        self.job_attrs = JobAttributes(self.entry_config.entry_name)
        self.job_params = JobParams(self.entry_config.entry_name)
        self.glidein_descript = GlideinDescript()
        self.frontend_descript = FrontendDescript()
        self.signatures = SignatureFile()
        os.chdir(self.testdir)

    def tearDown(self):
        os.chdir(self.testdir)
        rsafile = os.path.join(self.confdir, 'rsa.key')
        if os.path.exists(rsafile):
            cmd = "git checkout %s " % rsafile
            os.system(cmd)

    def test__init__(self):
        self.assertTrue(isinstance(self.factory_config, FactoryConfig))

    def test_get_all_usernames(self):
        all = self.frontend_descript.get_all_usernames()
        self.assertEqual([u'frontend'], all)

    def test_get_identity(self):
        id = self.frontend_descript.get_identity('vofrontend_service')
        self.assertEqual('*****@*****.**', id)

    def test_get_username(self):
        id = self.frontend_descript.get_username(
            'vofrontend_service', 'frontend')
        self.assertEqual('frontend', id)

    def test_get_all_frontend_sec_classes(self):
        id = self.frontend_descript.get_all_frontend_sec_classes()
        self.assertEqual([u'vofrontend_service:frontend'], id)

    def test_get_frontend_name(self):
        id = self.frontend_descript.get_frontend_name(
            '*****@*****.**')
        self.assertEqual('vofrontend_service', id)

    def test__contains__(self):
        self.assertFalse(self.frontend_descript.__contains__('bazzlesnort'))
        self.assertTrue(
            self.frontend_descript.__contains__('vofrontend_service'))

    def test_has_key(self):
        self.assertFalse('bazzlesnort' in self.frontend_descript)
        self.assertTrue('vofrontend_service' in self.frontend_descript)

    def test_str_(self):
        strdict = self.frontend_descript.__str__()
        self.assertTrue(isinstance(strdict, str))
        self.assertNotEqual('', strdict)

    def test_backup_and_load_old_key(self):
        os.chdir(self.confdir)
        self.glidein_descript.backup_and_load_old_key()
        os.chdir(self.testdir)

    def test_backup_rsa_key(self):
        os.chdir(self.confdir)
        self.glidein_descript.backup_rsa_key()
        os.chdir(self.testdir)

    def test_load_old_rsa_key(self):
        os.chdir(self.confdir)
        self.glidein_descript.load_old_rsa_key()
        os.chdir(self.testdir)

    def test_remove_old_key(self):
        os.chdir(self.confdir)
        self.glidein_descript.remove_old_key()
        os.chdir(self.testdir)

    def test_load_pub_key(self):
        os.chdir(self.confdir)
        self.glidein_descript.load_pub_key(True)
        os.chdir(self.testdir)
Exemplo n.º 5
0
class TestFactoryConfig(unittest.TestCase):
    def setUp(self):
        self.testdir = os.getcwd()
        self.confdir = 'fixtures/factory/work-dir'
        os.system('git checkout %s' % self.confdir)
        os.chdir(self.confdir)
        self.factory_config = FactoryConfig()
        self.entry_config = EntryConfigFile('el6_osg34', 'attributes.cfg')
        self.job_descript = JobDescript(self.entry_config.entry_name)
        self.job_attrs = JobAttributes(self.entry_config.entry_name)
        self.job_params = JobParams(self.entry_config.entry_name)
        self.glidein_descript = GlideinDescript()
        self.frontend_descript = FrontendDescript()
        self.signatures = SignatureFile()
        os.chdir(self.testdir)

    def tearDown(self):
        os.chdir(self.testdir)
        rsafile = os.path.join(self.confdir, 'rsa.key')
        if os.path.exists(rsafile):
            cmd = "git checkout %s " % rsafile
            os.system(cmd)

    def test__init__(self):
        self.assertTrue(isinstance(self.factory_config, FactoryConfig))

    def test_get_all_usernames(self):
        all = self.frontend_descript.get_all_usernames()
        self.assertEqual([u'frontend'], all)

    def test_get_identity(self):
        id = self.frontend_descript.get_identity('vofrontend_service')
        self.assertEqual('*****@*****.**', id)

    def test_get_username(self):
        id = self.frontend_descript.get_username('vofrontend_service',
                                                 'frontend')
        self.assertEqual('frontend', id)

    def test_get_all_frontend_sec_classes(self):
        id = self.frontend_descript.get_all_frontend_sec_classes()
        self.assertEqual([u'vofrontend_service:frontend'], id)

    def test_get_frontend_name(self):
        id = self.frontend_descript.get_frontend_name(
            '*****@*****.**')
        self.assertEqual('vofrontend_service', id)

    def test__contains__(self):
        self.assertFalse(self.frontend_descript.__contains__('bazzlesnort'))
        self.assertTrue(
            self.frontend_descript.__contains__('vofrontend_service'))

    def test_has_key(self):
        self.assertFalse('bazzlesnort' in self.frontend_descript)
        self.assertTrue('vofrontend_service' in self.frontend_descript)

    def test_str_(self):
        strdict = self.frontend_descript.__str__()
        self.assertTrue(isinstance(strdict, str))
        self.assertNotEqual('', strdict)

    def test_backup_and_load_old_key(self):
        os.chdir(self.confdir)
        self.glidein_descript.backup_and_load_old_key()
        os.chdir(self.testdir)

    def test_backup_rsa_key(self):
        os.chdir(self.confdir)
        self.glidein_descript.backup_rsa_key()
        os.chdir(self.testdir)

    def test_load_old_rsa_key(self):
        os.chdir(self.confdir)
        self.glidein_descript.load_old_rsa_key()
        os.chdir(self.testdir)

    def test_remove_old_key(self):
        os.chdir(self.confdir)
        self.glidein_descript.remove_old_key()
        os.chdir(self.testdir)

    def test_load_pub_key(self):
        os.chdir(self.confdir)
        self.glidein_descript.load_pub_key(True)
        os.chdir(self.testdir)