Beispiel #1
0
 def setUp(self):
     super(ConsoleOutputPolicyTest, self).setUp()
     self.controller = console_output.ConsoleOutputController()
     self.req = fakes.HTTPRequest.blank('')
     self.mock_get = self.useFixture(
         fixtures.MockPatch('nova.api.openstack.common.get_instance')).mock
     uuid = uuids.fake_id
     self.instance = fake_instance.fake_instance_obj(
         self.project_member_context,
         project_id=self.project_id,
         id=1,
         uuid=uuid,
         vm_state=vm_states.ACTIVE,
         task_state=None,
         launched_at=timeutils.utcnow())
     self.mock_get.return_value = self.instance
     # Check that admin or owner is able to get the server console.
     self.admin_authorized_contexts = [
         self.legacy_admin_context, self.system_admin_context,
         self.project_admin_context, self.project_member_context,
         self.project_reader_context, self.project_foo_context
     ]
     # Check that non-admin and non-owner is not able to get the server
     # console.
     self.admin_unauthorized_contexts = [
         self.system_member_context,
         self.system_reader_context,
         self.system_foo_context,
         self.other_project_member_context,
         self.other_project_reader_context,
     ]
 def setUp(self):
     super(ConsoleOutputPolicyEnforcementV21, self).setUp()
     self.controller = console_output_v21.ConsoleOutputController()