예제 #1
0
    def setUp(self):
        cache_opts = {
            'cache.type': 'memory',
            'cache.regions': 'public.data,public.filtered_data,public.shortlived'
        }
        CacheManager(**parse_cache_config_options(cache_opts))
        self.__request = DummyRequest()
        # Must set hook_zca to false to work with uniittest_with_sqlite
        reg = Registry()
        reg.settings = {}
        reg.settings = {'extract.available_grades': '3,4,5,6,7,8,9,11',
                        'hpz.file_upload_base_url': 'http://somehost:82/files',
                        'extract.raw_data_base_dir': '/opt/edware/raw_data'}
        self.__config = testing.setUp(registry=reg, request=self.__request, hook_zca=False)
        self.__tenant_name = get_unittest_tenant_name()

        defined_roles = [(Allow, RolesConstants.AUDIT_XML_EXTRACTS, ('view', 'logout'))]
        edauth.set_roles(defined_roles)
        set_tenant_map({get_unittest_tenant_name(): 'NC'})
        # Set up context security
        dummy_session = create_test_session([RolesConstants.AUDIT_XML_EXTRACTS])
        self.__config.testing_securitypolicy(dummy_session.get_user())
        # celery settings for UT
        settings = {'extract.celery.CELERY_ALWAYS_EAGER': True}
        setup_celery(settings)
        # for UT purposes
        smarter.extracts.format.json_column_mapping = {}
        set_tenant_map({'tomcat': 'NC'})
    def setUp(self):
        cache_opts = {
            'cache.type': 'memory',
            'cache.regions':
            'public.data,public.filtered_data,public.shortlived'
        }
        CacheManager(**parse_cache_config_options(cache_opts))
        self.__request = DummyRequest()
        # Must set hook_zca to false to work with uniittest_with_sqlite
        reg = Registry()
        reg.settings = {}
        reg.settings = {
            'extract.available_grades': '3,4,5,6,7,8,9,11',
            'hpz.file_upload_base_url': 'http://somehost:82/files',
            'extract.item_level_base_dir': '/opt/edware/item_level'
        }
        self.__config = testing.setUp(registry=reg,
                                      request=self.__request,
                                      hook_zca=False)
        self.__tenant_name = get_unittest_tenant_name()

        defined_roles = [(Allow, RolesConstants.ITEM_LEVEL_EXTRACTS,
                          ('view', 'logout'))]
        edauth.set_roles(defined_roles)
        set_tenant_map({get_unittest_tenant_name(): 'NC'})
        # Set up context security
        dummy_session = create_test_session(
            [RolesConstants.ITEM_LEVEL_EXTRACTS])
        self.__config.testing_securitypolicy(dummy_session.get_user())
        # celery settings for UT
        settings = {'extract.celery.CELERY_ALWAYS_EAGER': True}
        setup_celery(settings)
        # for UT purposes
        smarter.extracts.format.json_column_mapping = {}
        set_tenant_map({'tomcat': 'NC'})
예제 #3
0
 def setUp(self):
     self.reg = Registry()
     self.__temp_dir = tempfile.TemporaryDirectory()
     self.__work_zone_dir = os.path.join(self.__temp_dir.name, 'work_zone')
     self.__raw_data_base_dir = os.path.join(self.__temp_dir.name, 'raw_data')
     self.__item_level_base_dir = os.path.join(self.__temp_dir.name, 'item_level')
     self.reg.settings = {'extract.work_zone_base_dir': self.__work_zone_dir,
                          'hpz.file_upload_base_url': 'http://somehost:82/files',
                          'extract.available_grades': '3,4,5,6,7,8,11',
                          'extract.raw_data_base_dir': self.__raw_data_base_dir,
                          'extract.item_level_base_dir': self.__item_level_base_dir}
     settings = {'extract.celery.CELERY_ALWAYS_EAGER': True}
     setup_celery(settings)
     cache_opts = {
         'cache.type': 'memory',
         'cache.regions': 'public.data,public.filtered_data,public.shortlived'
     }
     CacheManager(**parse_cache_config_options(cache_opts))
     # Set up user context
     self.__request = DummyRequest()
     # Must set hook_zca to false to work with unittest_with_sqlite
     self.__config = testing.setUp(registry=self.reg, request=self.__request, hook_zca=False)
     defined_roles = [(Allow, RolesConstants.SAR_EXTRACTS, ('view', 'logout')),
                      (Allow, RolesConstants.AUDIT_XML_EXTRACTS, ('view', 'logout')),
                      (Allow, RolesConstants.ITEM_LEVEL_EXTRACTS, ('view', 'logout'))]
     edauth.set_roles(defined_roles)
     dummy_session = create_test_session([RolesConstants.SAR_EXTRACTS, RolesConstants.AUDIT_XML_EXTRACTS, RolesConstants.ITEM_LEVEL_EXTRACTS])
     self.__config.testing_securitypolicy(dummy_session.get_user())
     set_tenant_map({get_unittest_tenant_name(): 'NC'})
 def setUp(self):
     self.reg = Registry()
     self.__work_zone_dir = tempfile.TemporaryDirectory()
     self.reg.settings = {
         'extract.work_zone_base_dir': '/tmp/work_zone',
         'extract.available_grades': '3,4,5,6,7,8,11',
         'hpz.file_upload_base_url': 'http://somehost:82/files'
     }
     settings = {'extract.celery.CELERY_ALWAYS_EAGER': True}
     setup_celery(settings)
     cache_opts = {
         'cache.type': 'memory',
         'cache.regions':
         'public.data,public.filtered_data,public.shortlived'
     }
     CacheManager(**parse_cache_config_options(cache_opts))
     # Set up user context
     self.__request = DummyRequest()
     # Must set hook_zca to false to work with unittest_with_sqlite
     self.__config = testing.setUp(registry=self.reg,
                                   request=self.__request,
                                   hook_zca=False)
     defined_roles = [
         (Allow, RolesConstants.SRS_EXTRACTS, ('view', 'logout')),
         (Allow, RolesConstants.SRC_EXTRACTS, ('view', 'logout'))
     ]
     edauth.set_roles(defined_roles)
     dummy_session = create_test_session(
         [RolesConstants.SRS_EXTRACTS, RolesConstants.SRC_EXTRACTS])
     self.__config.testing_securitypolicy(dummy_session.get_user())
     set_tenant_map({get_unittest_tenant_name(): 'NC'})
 def setUp(self):
     settings = {Config.HOMEDIR: '~/.gpg',
                 Config.BINARYFILE: 'gpg',
                 Config.KEYSERVER: 'the_key_keeper',
                 Config.PICKUP_ROUTE_BASE_DIR: 'route',
                 'extract.celery.CELERY_ALWAYS_EAGER': 'True',
                 'extract.retries_allowed': '1',
                 'extract.retry_delay': '3'}
     setup_celery(settings)
     setup_settings(settings)
예제 #6
0
 def setUp(self):
     settings = {
         Config.HOMEDIR: '~/.gpg',
         Config.BINARYFILE: 'gpg',
         Config.KEYSERVER: 'the_key_keeper',
         Config.PICKUP_ROUTE_BASE_DIR: 'route',
         'extract.celery.CELERY_ALWAYS_EAGER': 'True',
         'extract.retries_allowed': '1',
         'extract.retry_delay': '3'
     }
     setup_celery(settings)
     setup_settings(settings)
예제 #7
0
 def setUp(self):
     here = os.path.abspath(os.path.dirname(__file__))
     gpg_home = os.path.abspath(
         os.path.join(here, "..", "..", "..", "..", "config", "gpg"))
     settings = {
         'extract.celery.BROKER_URL': 'memory',
         'extract.gpg.keyserver': None,
         'extract.gpg.homedir': gpg_home,
         'extract.gpg.public_key.cat': '*****@*****.**',
         'extract.celery.CELERY_ALWAYS_EAGER': 'True',
         'extract.retries_allowed': '1',
         'extract.retry_delay': '3',
         'hpz.file_upload_base_url': 'http://somehost:82/files',
     }
     setup_celery(settings)
     setup_settings(settings)
     self._tenant = get_unittest_tenant_name()
     self.__files = ['a.txt', 'b.txt', 'c.txt']
     self.__tmp_dir = tempfile.mkdtemp('file_archiver_test')
     self.__tmp_zip = os.path.join(tempfile.mkdtemp('zip'), 'test.zip')
     for file in self.__files:
         with open(os.path.join(self.__tmp_dir, file), "w") as f:
             f.write('hello ' + file)
     self.maxDiff = None
예제 #8
0
 def test_setup_celery(self):
     celery_config = {'celery.BROKER_URL': 'amqp://*****:*****@localhost:1234//',
                      'celery.CELERY_ALWAYS_EAGER': 'True'}
     setup_celery(celery_config, 'celery')
     self.assertEqual(celery.conf['BROKER_URL'], celery_config['celery.BROKER_URL'])
     self.assertEqual(celery.conf['CELERY_ALWAYS_EAGER'], True)