コード例 #1
0
 def test_multi_tenant_location_custom_endpoint_type(self):
     self.config(swift_store_endpoint_type='InternalURL')
     fake_get_endpoint = FakeGetEndpoint('https://some_endpoint')
     self.stubs.Set(auth, 'get_endpoint', fake_get_endpoint)
     ctxt = context.RequestContext(user='******',
                                   tenant='tenant',
                                   auth_token='123',
                                   service_catalog={})
     store = swift.MultiTenantStore(self.conf)
     store.configure()
     store._get_endpoint(ctxt)
     self.assertEqual(fake_get_endpoint.endpoint_type, 'InternalURL')
コード例 #2
0
 def test_multi_tenant_location_http(self):
     fake_get_endpoint = FakeGetEndpoint('http://some_endpoint')
     self.stubs.Set(auth, 'get_endpoint', fake_get_endpoint)
     ctxt = context.RequestContext(user='******',
                                   tenant='tenant',
                                   auth_token='123',
                                   service_catalog={})
     store = swift.MultiTenantStore(self.conf)
     store.configure()
     location = store.create_location('image-id', context=ctxt)
     self.assertEqual(location.scheme, 'swift+http')
     self.assertEqual(location.swift_url, 'http://some_endpoint')
コード例 #3
0
 def setUp(self):
     super(TestMultiTenantStoreConnections, self).setUp()
     moxfixture = self.useFixture(moxstubout.MoxStubout())
     self.stubs = moxfixture.stubs
     self.stubs.Set(swiftclient, 'Connection', FakeConnection)
     self.context = context.RequestContext(user='******',
                                           tenant='tenant',
                                           auth_token='0123')
     self.store = swift.MultiTenantStore(self.conf)
     specs = {
         'scheme': 'swift',
         'auth_or_store_url': 'example.com',
         'container': 'cont',
         'obj': 'object'
     }
     self.location = swift.StoreLocation(specs, self.conf)
     self.addCleanup(self.conf.reset)
コード例 #4
0
 def test_multi_tenant_location(self):
     self.config(swift_store_container='container')
     fake_get_endpoint = FakeGetEndpoint('https://some_endpoint')
     self.stubs.Set(auth, 'get_endpoint', fake_get_endpoint)
     ctxt = context.RequestContext(user='******',
                                   tenant='tenant',
                                   auth_token='123',
                                   service_catalog={})
     store = swift.MultiTenantStore(self.conf)
     store.configure()
     location = store.create_location('image-id', context=ctxt)
     self.assertEqual(location.scheme, 'swift+https')
     self.assertEqual(location.swift_url, 'https://some_endpoint')
     self.assertEqual(location.container, 'container_image-id')
     self.assertEqual(location.obj, 'image-id')
     self.assertIsNone(location.user)
     self.assertIsNone(location.key)
     self.assertEqual(fake_get_endpoint.service_type, 'object-store')