def setup_class(cls): reset_db() archiver_model.init_tables(model.meta.engine) cls.temp_dir = tempfile.mkdtemp() cls.config = config.__file__
def setup(self): # inherited setup does reset_db() super(DguFunctionalTestBase, self).setup() # init DGU-specific models commitment.init_tables(model.meta.engine) archiver.init_tables(model.meta.engine)
def setup_class(cls): dest_dir = config.get('ckanext.packagezip.destination_dir') if not os.path.isdir(dest_dir): os.mkdir(dest_dir) cls.config = config['__file__'] archiver_model.init_tables(model.meta.engine) packagezip_model.init_tables(model.meta.engine)
def command(self): """ Parse command line arguments and call appropriate method. """ if not self.args or self.args[0] in ['--help', '-h', 'help']: print self.usage sys.exit(1) cmd = self.args[0] self._load_config() # Initialise logger after the config is loaded, so it is not disabled. self.log = logging.getLogger(__name__) if cmd == 'update': self.update() if cmd == 'update-max': self.update_max() elif cmd == 'update-test': self.update_test() elif cmd == 'clean-status': self.clean_status() elif cmd == 'clean-cached-resources': self.clean_cached_resources() elif cmd == 'view': if len(self.args) == 2: self.view(self.args[1]) else: self.view() elif cmd == 'report': if len(self.args) != 2: self.log.error( 'Command requires a parameter, the name of the output') return self.report(self.args[1], delete=False) elif cmd == 'delete-orphans': if len(self.args) != 2: self.log.error( 'Command requires a parameter, the name of the output') return self.report(self.args[1], delete=True) elif cmd == 'init': import ckan.model as model from ckanext.archiver.model import init_tables init_tables(model.meta.engine) self.log.info('Archiver tables are initialized') elif cmd == 'migrate-archive-dirs': self.migrate_archive_dirs() elif cmd == 'migrate': self.migrate() elif cmd == 'size-report': self.size_report() elif cmd == 'delete-files-larger-than-max': self.delete_files_larger_than_max_content_length() else: self.log.error('Command %s not recognized' % (cmd, ))
def setup_class(cls): archiver_model.init_tables(model.meta.engine) qa_model.init_tables(model.meta.engine) cls.fake_resource = { 'id': u'fake_resource_id', 'url': 'http://remotesite.com/filename.csv', 'cache_url': 'http://remotesite.com/resources/filename.csv', 'cache_filepath': __file__, # must exist 'package': u'fake_package_id', 'is_open': True, 'position': 2, }
def setup_class(cls): DguCreateTestData.create_dgu_test_data() DguCreateTestData.create_arbitrary({'name': 'latest', 'notes': '<b>Latest</b> dataset.', 'tags': ['tag1', 'tag2'], 'extras': {'key': 'value'}, 'groups': ['national-health-service']}) cls._assert_revision_created() model.Session.remove() # ensure last revision appears from ckanext.archiver.model import init_tables init_tables(model.meta.engine)
def command(self): """ Parse command line arguments and call appropriate method. """ if not self.args or self.args[0] in ['--help', '-h', 'help']: print self.usage sys.exit(1) cmd = self.args[0] self._load_config() # Initialise logger after the config is loaded, so it is not disabled. self.log = logging.getLogger(__name__) if cmd == 'update': self.update() elif cmd == 'update-test': self.update_test() elif cmd == 'clean-status': self.clean_status() elif cmd == 'clean-cached-resources': self.clean_cached_resources() elif cmd == 'view': if len(self.args) == 2: self.view(self.args[1]) else: self.view() elif cmd == 'report': if len(self.args) != 2: self.log.error('Command requires a parameter, the name of the output') return self.report(self.args[1], delete=False) elif cmd == 'delete-orphans': if len(self.args) != 2: self.log.error('Command requires a parameter, the name of the output') return self.report(self.args[1], delete=True) elif cmd == 'init': import ckan.model as model from ckanext.archiver.model import init_tables init_tables(model.meta.engine) self.log.info('Archiver tables are initialized') elif cmd == 'migrate-archive-dirs': self.migrate_archive_dirs() elif cmd == 'migrate': self.migrate() elif cmd == 'size-report': self.size_report() elif cmd == 'delete-files-larger-than-max': self.delete_files_larger_than_max_content_length() else: self.log.error('Command %s not recognized' % (cmd,))
def setup_class(cls): DguCreateTestData.create_dgu_test_data() DguCreateTestData.create_arbitrary( { "name": "latest", "notes": "<b>Latest</b> dataset.", "tags": ["tag1", "tag2"], "extras": {"key": "value"}, "groups": ["national-health-service"], } ) cls._assert_revision_created() model.Session.remove() # ensure last revision appears from ckanext.archiver.model import init_tables init_tables(model.meta.engine)
def setup_class(cls): reset_db() archiver_model.init_tables(model.meta.engine) qa_model.init_tables(model.meta.engine)
def init(): import ckan.model as model from ckanext.archiver.model import init_tables init_tables(model.meta.engine)
def initdb(self): from ckan import model from ckanext.archiver.model import init_tables init_tables(model.meta.engine) log.info('Archiver tables are initialized')
def initial_data(self, clean_db): archiver_model.init_tables(model.meta.engine)
def initial_data(cls, clean_db): archiver_model.init_tables(model.meta.engine) cls.temp_dir = tempfile.mkdtemp()
def setup_class(cls): ckan_helpers.reset_db() archiver_model.init_tables(model.meta.engine)
def setup_class(cls): archiver_model.init_tables(model.meta.engine) qa_model.init_tables(model.meta.engine)
def setup_class(cls): reset_db() archiver_model.init_tables(model.meta.engine)
def setup_class(cls): ckan_helpers.reset_db() archiver_model.init_tables(model.meta.engine) cls.temp_dir = tempfile.mkdtemp()