Example #1
0
    def setup_class(cls):
        super(TestAuthorisation, cls).setup_class()
        model.repo.new_revision()
        model.Session.commit()

        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_sysadmin = user_model.User.get('test_sysadmin')
        cls.api_test_sysadmin = ckanapi.TestAppCKAN(cls.app, apikey=cls.test_sysadmin.apikey)
        cls.api_test_user = ckanapi.TestAppCKAN(cls.app, apikey=cls.test_user.apikey)
        org_dict = {'name': 'test_organisation', 'title': 'Test Organisation'}
        cls.api_test_sysadmin.action.organization_create(**org_dict)
        cls.TEST_DATADICT = copy.deepcopy(TEST_DATADICT)
        cls.TEST_DATADICT['owner_org'] = 'test_organisation'
Example #2
0
    def setup_class(cls):
        super(TestAuthorisation, cls).setup_class()
        model.repo.new_revision()
        model.Session.commit()

        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_sysadmin = user_model.User.get('test_sysadmin')
        cls.api_test_sysadmin = ckanapi.TestAppCKAN(
            cls.app, apikey=cls.test_sysadmin.apikey)
        cls.api_test_user = ckanapi.TestAppCKAN(cls.app,
                                                apikey=cls.test_user.apikey)
        org_dict = {'name': 'test_organisation', 'title': 'Test Organisation'}
        cls.api_test_sysadmin.action.organization_create(**org_dict)
        cls.TEST_DATADICT = copy.deepcopy(TEST_DATADICT)
        cls.TEST_DATADICT['owner_org'] = 'test_organisation'
 def setup_users(cls):
     CreateTestData.create_users([{
         u'name': u'sysadmin',
         u'fullname': u'Test Sysadmin',
         u'password': u'pass',
         u'sysadmin': True
     }, {
         u'name': u'test',
         u'fullname': u'Test user',
         u'password': u'pass',
         u'sysadmin': False
     }])
     cls.sysadmin_context = {'user': '******', 'model': model}
     cls.normal_context = {'user': '******', 'model': model}
     cls.empty_context = {'user': '', 'model': model}
 def setup_users(cls):
     CreateTestData.create_users([{
         u'name': u'sysadmin',
         u'fullname': u'Test Sysadmin',
         u'password': u'pass',
         u'sysadmin': True
     }, {
         u'name': u'test',
         u'fullname': u'Test user',
         u'password': u'pass',
         u'sysadmin': False
     }])
     cls.sysadmin_context = {'user': '******', 'model': model}
     cls.normal_context = {'user': '******', 'model': model}
     cls.empty_context = {'user': '', 'model': model}
Example #5
0
    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)
Example #6
0
    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']