'Verify authenticate to a project with unsafe name fails.'

def test_authenticate_fails_if_project_unsafe(self):

    self.config_fixture.config(group='resource', project_name_url_safe='off')
    unsafe_name = 'i    am    not    /    safe'
    project = unit.new_project_ref(domain_id=CONF.identity.default_domain_id, name=unsafe_name)
    self.resource_api.create_project(project['id'], project)
    self.assignment_api.add_role_to_user_and_project(self.user_foo['id'], project['id'], self.role_member['id'])
    empty_request = self.make_request()
    body_dict = _build_user_auth(username=self.user_foo['name'], password=self.user_foo['password'], tenant_name=project['name'])
    self.controller.authenticate(empty_request, body_dict)
    self.config_fixture.config(group='resource', project_name_url_safe='strict')
    self.assertRaises(exception.Unauthorized, self.controller.authenticate, empty_request, body_dict)
