Exemplo n.º 1
0
    def test_get_test_admin_context(self):
        """get_test_admin_context's return value behaves like admin context."""
        ctxt = test_utils.get_test_admin_context()

        # TODO(soren): This should verify the full interface context
        # objects expose.
        self.assertTrue(ctxt.is_admin)
Exemplo n.º 2
0
    def test_get_test_admin_context(self):
        """get_test_admin_context's return value behaves like admin context."""
        ctxt = test_utils.get_test_admin_context()

        # TODO(soren): This should verify the full interface context
        # objects expose.
        self.assertTrue(ctxt.is_admin)
Exemplo n.º 3
0
    def test_same_filter_handles_deleted_instance(self):
        filt_cls = self.class_map['SameBackendFilter']()
        host = fakes.FakeHostState('host1', {})
        volume = utils.create_volume(self.context, host='host2')
        vol_id = volume.id
        db.volume_destroy(utils.get_test_admin_context(), vol_id)

        filter_properties = {'context': self.context.elevated(),
                             'scheduler_hints': {
            'same_host': [vol_id], }}

        self.assertFalse(filt_cls.host_passes(host, filter_properties))
Exemplo n.º 4
0
    def test_same_filter_handles_deleted_instance(self):
        filt_cls = self.class_map['SameBackendFilter']()
        host = fakes.FakeHostState('host1', {})
        volume = utils.create_volume(self.context, host='host2')
        vol_id = volume.id
        db.volume_destroy(utils.get_test_admin_context(), vol_id)

        filter_properties = {
            'context': self.context.elevated(),
            'scheduler_hints': {
                'same_host': [vol_id],
            }
        }

        self.assertFalse(filt_cls.host_passes(host, filter_properties))
Exemplo n.º 5
0
    def test_get_test_admin_context(self):
        """get_test_admin_context's return value behaves like admin context."""
        ctxt = test_utils.get_test_admin_context()

        self.assertIsNone(ctxt.project_id)
        self.assertIsNone(ctxt.user_id)
        self.assertIsNone(ctxt.domain)
        self.assertIsNone(ctxt.project_domain)
        self.assertIsNone(ctxt.user_domain)
        self.assertIsNone(ctxt.project_name)
        self.assertIsNone(ctxt.remote_address)
        self.assertIsNone(ctxt.auth_token)
        self.assertIsNone(ctxt.quota_class)

        self.assertIsNotNone(ctxt.request_id)
        self.assertIsNotNone(ctxt.timestamp)

        self.assertEqual(['admin'], ctxt.roles)
        self.assertEqual([], ctxt.service_catalog)
        self.assertEqual('no', ctxt.read_deleted)

        self.assertTrue(ctxt.read_deleted)
        self.assertTrue(ctxt.is_admin)