

@mock.patch('glance_store._drivers.swift.utils.is_multiple_swift_store_accounts_enabled', mock.Mock(return_value=False))
def test_multi_container_doesnt_impact_multi_tenant_add(self):
    expected_swift_size = FIVE_KB
    expected_swift_contents = (b'*' * expected_swift_size)
    expected_image_id = str(uuid.uuid4())
    expected_container = ('container_' + expected_image_id)
    loc = 'swift+https://some_endpoint/%s/%s'
    expected_location = (loc % (expected_container, expected_image_id))
    image_swift = six.BytesIO(expected_swift_contents)
    global SWIFT_PUT_OBJECT_CALLS
    SWIFT_PUT_OBJECT_CALLS = 0
    self.config(swift_store_container='container')
    _.config(swift_store_create_container_on_put=True)
    self.config(swift_store_multiple_containers_seed=2)
    service_catalog = [{
        'endpoint_links': [],
        'endpoints': [{
            'adminURL': 'https://some_admin_endpoint',
            'region': 'RegionOne',
            'internalURL': 'https://some_internal_endpoint',
            'publicURL': 'https://some_endpoint',
        }],
        'type': 'object-store',
        'name': 'Object Storage Service',
    }]
    ctxt = mock.MagicMock(user='user', tenant='tenant', auth_token='123', service_catalog=service_catalog)
    store = swift.MultiTenantStore(self.conf)
    store.configure()
    (location, size, checksum, _) = store.add(expected_image_id, image_swift, expected_swift_size, context=ctxt)
    self.assertEqual(expected_location, location)

dataset/ETHPy150Open openstack/glance_store/glance_store/tests/unit/test_swift_store.py SwiftTests.test_multi_container_doesnt_impact_multi_tenant_add/VarMisuse@99/211 `self`->`_`