'Ensure we cannot access the hidden root of all project domains.
Calling any of the driver methods should result in the same as
would be returned if we passed a project that does not exist. We don\'t
test create_project, since we do not allow a caller of our API to
specify their own ID for a new entity.'

def test_hidden_project_domain_root_is_really_hidden(self):

    def _exercise_project_api(ref_id):
        driver = self.resource_api.driver
        self.assertRaises(exception.ProjectNotFound, driver.get_project, ref_id)
        self.assertRaises(exception.ProjectNotFound, driver.get_project_by_name, resource.NULL_DOMAIN_ID, ref_id)
        project_ids = [x['id'] for x in driver.list_projects(driver_hints.Hints())]
        self.assertNotIn(ref_id, project_ids)
        projects = driver.list_projects_from_ids([ref_id])
        self.assertThat(projects, matchers.HasLength(0))
        project_ids = [x for x in driver.list_project_ids_from_domain_ids([ref_id])]
        self.assertNotIn(ref_id, project_ids)
        self.assertRaises(exception.DomainNotFound, driver.list_projects_in_domain, ref_id)
        project_ids = [x['id'] for x in driver.list_projects_acting_as_domain(driver_hints.Hints())]
        self.assertNotIn(ref_id, project_ids)
        projects = driver.list_projects_in_subtree(ref_id)
        self.assertThat(projects, matchers.HasLength(0))
        self.assertRaises(exception.ProjectNotFound, driver.list_project_parents, ref_id)
        self.assertTrue(driver.is_leaf_project(ref_id))
        self.assertRaises(exception.ProjectNotFound, driver.update_project, ref_id, {})
        self.assertRaises(exception.ProjectNotFound, driver.delete_project, ref_id)
        driver.delete_projects_from_ids([ref_id])
    _exercise_project_api(uuid.uuid4().hex)
    _exercise_project_api(resource.NULL_DOMAIN_ID)
