def setup_class(cls): """Setup for all tests.""" model.repo.rebuild_db() kata_model.setup() CreateTestData.create() cls.user_sysadmin = model.User.get('testsysadmin') # Org admin cls.user_normal = model.User.get('tester') # Org editor cls.user_anna = model.User.get('annafan') cls.user_joe = model.User.get('joeadmin') # Org member wsgiapp = make_app(config['global_conf'], **config['app_conf']) cls.app = paste.fixture.TestApp(wsgiapp) # Set up API callers cls.api_user_normal = ckanapi.TestAppCKAN(cls.app, apikey=cls.user_normal.apikey) cls.api_user_sysadmin = ckanapi.TestAppCKAN(cls.app, apikey=cls.user_sysadmin.apikey) cls.api_user_anna = ckanapi.TestAppCKAN(cls.app, apikey=cls.user_anna.apikey) cls.api_user_joe = ckanapi.TestAppCKAN(cls.app, apikey=cls.user_joe.apikey) cls.api = ckanapi.TestAppCKAN(cls.app) cls.TEST_DATADICT = copy.deepcopy(TEST_DATADICT) try: output = cls.api_user_sysadmin.action.organization_create(**TEST_ORGANIZATION_COMMON) cls.TEST_DATADICT['owner_org'] = output.get('id') except AppError: print 'Failed to create a common organization. Perhaps it exists already.'
def setup_class(cls): ''' Setup database and variables ''' harvest_model.setup() kata_model.setup() cls.harvester = OAIPMHHarvester()
def setup_class(cls): ''' Setup database and variables ''' ckan.model.repo.rebuild_db() harvest_model.setup() kata_model.setup() cls.harvester = OAIPMHHarvester()
def setup_class(cls): """Set up testing environment.""" kata_model.setup() CreateTestData.create() wsgiapp = make_app(config['global_conf'], **config['app_conf']) cls.app = paste.fixture.TestApp(wsgiapp)
def setup_class(self): ''' Setup database and variables ''' ckan.model.repo.rebuild_db() harvest_model.setup() kata_model.setup() self.ddi_harvester = dharvester.DDIHarvester()
def setup_class(cls): ''' Setup database and variables ''' ckan.model.repo.rebuild_db() harvest_model.setup() kata_model.setup() cls.ddi_converter = dconverter.DataConverter() # cls.ddi_xml = testdata.nr1 cls.ddi_xml = bs4.BeautifulSoup(testdata.nr1, 'xml')
def setup_class(cls): ''' Setup database ''' model.repo.rebuild_db() harvest_model.setup() kata_model.setup() # The Pylons globals are not available outside a request. This is a hack to provide context object. c = AttribSafeContextObj() py_obj = PylonsContext() py_obj.tmpl_context = c pylons.tmpl_context._push_object(c)
def initdb(self): # kata = Group.get('KATA') # if not kata: # repo.new_revision() # kata = Group(name="KATA", title="Tieteenalat") # kata.save() # for tiede in tieteet.tieteet: # t = Group(description=tiede['description'], # name=tiede['name'], # title=tiede['title']) # t.save() # m = Member(group=kata, table_id=t.id, table_name="group") # m.save() setup()
def initdb(self): kata = Group.get('KATA') if not kata: repo.new_revision() kata = Group(name="KATA", title="Tieteenalat") kata.save() for tiede in tieteet.tieteet: t = Group(description=tiede['description'], name=tiede['name'], title=tiede['title']) t.save() m = Member(group=kata, table_id=t.id, table_name="group") m.save() setup()
def setup_class(cls): kata_model.setup() users = [ {'name': 'test_sysadmin', 'sysadmin': True, 'apikey': 'test_sysadmin', 'password': '******'}, {'name': 'test_user', 'sysadmin': False, 'apikey': 'test_user', 'password': '******'}, {'name': 'test_user2', 'sysadmin': False, 'apikey': 'test_user2', 'password': '******'} ] CreateTestData.create_users(users) cls.test_user = user_model.User.get('test_user') cls.test_user2 = user_model.User.get('test_user2') cls.test_sysadmin = user_model.User.get('test_sysadmin') wsgiapp = make_app(config['global_conf'], **config['app_conf']) cls.app = paste.fixture.TestApp(wsgiapp) # Set up API callers cls.api_test_user = ckanapi.TestAppCKAN(cls.app, apikey=cls.test_user.apikey) cls.api_test_user2 = ckanapi.TestAppCKAN(cls.app, apikey=cls.test_user2.apikey) cls.api_test_sysadmin = ckanapi.TestAppCKAN(cls.app, apikey=cls.test_sysadmin.apikey) cls.api = ckanapi.TestAppCKAN(cls.app) org_dict = {'name': 'test_organisation', 'title': 'Test Organisation'} cls.api_test_sysadmin.action.organization_create(**org_dict) group_dict = {'name': 'test_group', 'title': 'Test Group'} cls.api_test_sysadmin.action.group_create(**group_dict) user_dict = {'id': 'test_organisation', 'username': '******', 'role': 'admin'} cls.api_test_sysadmin.action.organization_member_create(**user_dict) user_dict = {'id': 'test_group', 'username': '******', 'role': 'admin'} cls.api_test_sysadmin.action.group_member_create(**user_dict) cls.TEST_DATADICT = copy.deepcopy(TEST_DATADICT) cls.package_id = u'urn-nbn-fi-csc-kata20140728095757755621' cls.TEST_DATADICT['owner_org'] = 'test_organisation' cls.TEST_DATADICT['id'] = cls.package_id cls.api_test_user.action.package_create(**cls.TEST_DATADICT)
def setup_class(cls): """Set up testing environment.""" model.repo.rebuild_db() kata_model.setup() CreateTestData.create() comments_model.init_tables() wsgiapp = make_app(config['global_conf'], **config['app_conf']) cls.app = paste.fixture.TestApp(wsgiapp) # The Pylons globals are not available outside a request. This is a hack to provide context object. c = AttribSafeContextObj() py_obj = PylonsContext() py_obj.tmpl_context = c pylons.tmpl_context._push_object(c) # The lxml's HTML parser allows quite much errors so it is not really a good validation of the rendered pages. cls.html_parser = etree.HTMLParser()
def initdb(self): '''Database initialization''' setup()
def setup_class(cls): kata_model.setup() harvest_model.setup() model.User(name="test_sysadmin", sysadmin=True).save()
def setup_class(cls): ''' Setup database ''' harvest_model.setup() kata_model.setup()
def setup_class(cls): '''Set up testing environment.''' kata_model.setup() harvest_model.setup()
def setUp(self, *args, **kwargs): self.plugin = create_plugin(**kwargs) model.repo.rebuild_db() kata_model.setup()
def setup_class(cls): '''Set up testing environment.''' kata_model.setup() harvest_model.setup() CreateTestData.create()
def setUpClass(cls): harvest_model.setup() kata_model.setup()
def setup_class(cls): ''' Setup database and variables ''' harvest_model.setup() kata_model.setup() cls.harvester = CMDIHarvester()
def setup_class(cls): kata_model.setup() users = [{ 'name': 'test_sysadmin', 'sysadmin': True, 'apikey': 'test_sysadmin', 'password': '******' }, { 'name': 'test_user', 'sysadmin': False, 'apikey': 'test_user', 'password': '******' }, { 'name': 'test_user2', 'sysadmin': False, 'apikey': 'test_user2', 'password': '******' }] CreateTestData.create_users(users) cls.test_user = user_model.User.get('test_user') cls.test_user2 = user_model.User.get('test_user2') cls.test_sysadmin = user_model.User.get('test_sysadmin') wsgiapp = make_app(config['global_conf'], **config['app_conf']) cls.app = paste.fixture.TestApp(wsgiapp) # Set up API callers cls.api_test_user = ckanapi.TestAppCKAN(cls.app, apikey=cls.test_user.apikey) cls.api_test_user2 = ckanapi.TestAppCKAN(cls.app, apikey=cls.test_user2.apikey) cls.api_test_sysadmin = ckanapi.TestAppCKAN( cls.app, apikey=cls.test_sysadmin.apikey) cls.api = ckanapi.TestAppCKAN(cls.app) org_dict = {'name': 'test_organisation', 'title': 'Test Organisation'} cls.api_test_sysadmin.action.organization_create(**org_dict) group_dict = {'name': 'test_group', 'title': 'Test Group'} cls.api_test_sysadmin.action.group_create(**group_dict) user_dict = { 'id': 'test_organisation', 'username': '******', 'role': 'admin' } cls.api_test_sysadmin.action.organization_member_create(**user_dict) user_dict = { 'id': 'test_group', 'username': '******', 'role': 'admin' } cls.api_test_sysadmin.action.group_member_create(**user_dict) cls.TEST_DATADICT = copy.deepcopy(TEST_DATADICT) cls.TEST_DATADICT['owner_org'] = 'test_organisation' package = cls.api_test_user.action.package_create(**cls.TEST_DATADICT) cls.TEST_DATADICT['id'] = package['id'] cls.package_id = package['id']