Exemple #1
0
 def setUp(self):
     self.job_list = [make_job('foo'), make_job('bar')]
     self.whitelist_list = [
         WhiteList([], name='ihv-foo'), WhiteList([], name='other')]
     self.real_provider = DummyProvider1(
         job_list=self.job_list, whitelist_list=self.whitelist_list)
     self.ihv_provider = IHVProvider(self.real_provider)
Exemple #2
0
 def test_smoke(self):
     with self.mocked_file(self._name, self._content):
         whitelist = WhiteList.from_file(self._name)
     self.assertEqual(
         repr(whitelist.inclusive_qualifier_list[0]),
         "<RegExpJobQualifier pattern:'^foo$'>")
     self.assertTrue(whitelist.designates(make_job('foo')))
Exemple #3
0
    def __init__(self, provider, config, ns):
        self.provider = provider
        self.config = config
        self.ns = ns
        if self.ns.whitelist:
            self.whitelist = WhiteList.from_file(self.ns.whitelist[0].name)
        elif self.config.whitelist is not Unset:
            self.whitelist = WhiteList.from_file(self.config.whitelist)
        else:
            self.whitelist = WhiteList.from_file(os.path.join(
                self.provider.whitelists_dir, "sru.whitelist"))

        self.job_list = self.provider.get_builtin_jobs()
        # XXX: maybe allow specifying system_id from command line?
        self.exporter = XMLSessionStateExporter(system_id=None)
        self.session = None
        self.runner = None
Exemple #4
0
    def __init__(self, provider, config, ns):
        self.provider = provider
        self.config = config
        self.ns = ns
        if self.ns.whitelist:
            self.whitelist = WhiteList.from_file(self.ns.whitelist[0].name)
        elif self.config.whitelist is not Unset:
            self.whitelist = WhiteList.from_file(self.config.whitelist)
        else:
            self.whitelist = WhiteList.from_file(
                os.path.join(self.provider.whitelists_dir, "sru.whitelist"))

        self.job_list = self.provider.get_builtin_jobs()
        # XXX: maybe allow specifying system_id from command line?
        self.exporter = XMLSessionStateExporter(system_id=None)
        self.session = None
        self.runner = None
Exemple #5
0
 def get_builtin_whitelists(self):
     logger.debug("Loading built-in whitelists...")
     whitelist_list = []
     for name in os.listdir(self.whitelists_dir):
         if name.endswith(".whitelist"):
             whitelist_list.append(
                 WhiteList.from_file(os.path.join(
                     self.whitelists_dir, name)))
     return sorted(whitelist_list, key=lambda whitelist: whitelist.name)
Exemple #6
0
 def test_repr(self):
     """
     verify that custom repr works
     """
     whitelist = WhiteList([], name="test")
     self.assertEqual(repr(whitelist), "<WhiteList name:'test'>")
Exemple #7
0
 def test_load_patterns(self):
     with self.mocked_file(self._name, self._content):
         pattern_list = WhiteList._load_patterns(self._name)
     self.assertEqual(pattern_list, ['^foo$', '^bar$'])