def setUp(self):
     super(ImportLegacy, self).setUp()
     self.config([
         test.etcdir('keystone.conf.sample'),
         test.testsdir('test_overrides.conf'),
         test.testsdir('backend_sql.conf'),
         test.testsdir('backend_sql_disk.conf')
     ])
     test.setup_test_database()
     self.identity_man = identity.Manager()
     self.identity_api = identity_sql.Identity()
 def setUp(self):
     super(ImportLegacy, self).setUp()
     self.config(
         [
             test.etcdir("keystone.conf.sample"),
             test.testsdir("test_overrides.conf"),
             test.testsdir("backend_sql.conf"),
             test.testsdir("backend_sql_disk.conf"),
         ]
     )
     test.setup_test_database()
     self.identity_man = identity.Manager()
     self.identity_api = identity_sql.Identity()
Beispiel #3
0
    def setUp(self, load_sample_data=True):
        """Setup for v3 Restful Test Cases.

        If a child class wants to create their own sample data
        and provide their own auth data to obtain tokens, then
        load_sample_data should be set to false.

        """
        self.config(self.config_files())

        test.setup_test_database()
        self.load_backends()

        self.public_app = webtest.TestApp(
            self.loadapp('keystone', name='main'))
        self.admin_app = webtest.TestApp(
            self.loadapp('keystone', name='admin'))

        if load_sample_data:
            self.domain_id = uuid.uuid4().hex
            self.domain = self.new_domain_ref()
            self.domain['id'] = self.domain_id
            self.identity_api.create_domain(self.domain_id, self.domain)

            self.project_id = uuid.uuid4().hex
            self.project = self.new_project_ref(
                domain_id=self.domain_id)
            self.project['id'] = self.project_id
            self.identity_api.create_project(self.project_id, self.project)

            self.user_id = uuid.uuid4().hex
            self.user = self.new_user_ref(
                domain_id=self.domain_id,
                project_id=self.project_id)
            self.user['id'] = self.user_id
            self.identity_api.create_user(self.user_id, self.user)

            self.default_domain_project_id = uuid.uuid4().hex
            self.default_domain_project = self.new_project_ref(
                domain_id=DEFAULT_DOMAIN_ID)
            self.default_domain_project['id'] = self.default_domain_project_id
            self.identity_api.create_project(self.default_domain_project_id,
                                             self.default_domain_project)

            self.default_domain_user_id = uuid.uuid4().hex
            self.default_domain_user = self.new_user_ref(
                domain_id=DEFAULT_DOMAIN_ID,
                project_id=self.default_domain_project_id)
            self.default_domain_user['id'] = self.default_domain_user_id
            self.identity_api.create_user(self.default_domain_user_id,
                                          self.default_domain_user)

            # create & grant policy.json's default role for admin_required
            self.role_id = uuid.uuid4().hex
            self.role = self.new_role_ref()
            self.role['id'] = self.role_id
            self.role['name'] = 'admin'
            self.identity_api.create_role(self.role_id, self.role)
            self.identity_api.add_role_to_user_and_project(
                self.user_id, self.project_id, self.role_id)
            self.identity_api.add_role_to_user_and_project(
                self.default_domain_user_id, self.default_domain_project_id,
                self.role_id)
            self.identity_api.add_role_to_user_and_project(
                self.default_domain_user_id, self.project_id,
                self.role_id)

        self.public_server = self.serveapp('keystone', name='main')
        self.admin_server = self.serveapp('keystone', name='admin')