예제 #1
0
    def setup_class(self):
        model.repo.init_db()
        CreateTestData.create_test_user()
#        self.admin = model.User.by_name(u'russianfan')

#        self.extra_environ_admin = {'REMOTE_USER': self.admin.name.encode('utf8')}
        self.extra_environ_tester = {'REMOTE_USER': '******'}
예제 #2
0
    def setup_class(self):
        model.repo.init_db()
        CreateTestData.create_test_user()
        #        self.admin = model.User.by_name(u'russianfan')

        #        self.extra_environ_admin = {'REMOTE_USER': self.admin.name.encode('utf8')}
        self.extra_environ_tester = {'REMOTE_USER': '******'}
예제 #3
0
    def setup(self):
        """
        Creates a harvested UKLP dataset.
        """
        _drop_sysadmin()
        self.admin = _create_sysadmin()

        CreateTestData.create_test_user()
        self.tester = 'tester'

        CreateTestData.create_groups(_EXAMPLE_GROUPS, admin_user_name=self.tester, auth_profile='publisher')
        CreateTestData.flag_for_deletion(group_names=[g['name'] for g in _EXAMPLE_GROUPS])

        context = {
            'model': ckan.model,
            'session': ckan.model.Session,
            'user': self.admin,
            'api_version': 2,
            'schema': ckan.logic.schema.default_package_schema(),
        }
        package_dict = _UKLP_DATASET.copy()

        self.uklp_dataset = get_action('package_create_rest')(context, package_dict)

        CreateTestData.flag_for_deletion(pkg_names=[self.uklp_dataset['name']])
예제 #4
0
파일: seed.py 프로젝트: PublicaMundi/ckan
def user(ctx):
    flask_app = ctx.obj.app.apps[u'flask_app']._wsgi_app
    with flask_app.test_request_context():
        CreateTestData.create_test_user()
    click.echo(
        u'Created user {0} with password {0} and apikey {0}'.format(u'tester')
    )
예제 #5
0
    def setup(self):
        """
        Creates a harvested UKLP dataset.
        """
        _drop_sysadmin()
        self.admin = _create_sysadmin()

        CreateTestData.create_test_user()
        self.tester = "tester"

        CreateTestData.create_groups(_EXAMPLE_GROUPS, admin_user_name=self.tester, auth_profile="publisher")
        CreateTestData.flag_for_deletion(group_names=[g["name"] for g in _EXAMPLE_GROUPS])

        context = {
            "model": ckan.model,
            "session": ckan.model.Session,
            "user": self.admin,
            "api_version": 2,
            "schema": ckan.logic.schema.default_package_schema(),
        }
        package_dict = _UKLP_DATASET.copy()

        self.uklp_dataset = get_action("package_create_rest")(context, package_dict)

        CreateTestData.flag_for_deletion(pkg_names=[self.uklp_dataset["name"]])
예제 #6
0
def user(ctx):
    flask_app = ctx.meta['flask_app']
    with flask_app.test_request_context():
        CreateTestData.create_test_user()
    click.echo(
        u'Created user {0} with password {0} and apikey {0}'.format(u'tester'))
예제 #7
0
    def env_user(self, clean_db):
        CreateTestData.create_test_user()

        return {"REMOTE_USER": "******"}
예제 #8
0
 def initial_data(self, clean_db):
     CreateTestData.create()
     CreateTestData.create_test_user()