Merge remote branch '4p/master' into master_cb_merge_passing_tests
Conflicts: django-openstack/django_openstack/tests/api_tests.py openstack-dashboard/dashboard/settings.py
This commit is contained in:
commit
ad9004e3dd
@ -221,6 +221,18 @@ class User(APIResourceWrapper):
|
||||
_attrs = ['email', 'enabled', 'id', 'tenantId']
|
||||
|
||||
|
||||
class SwiftAuthentication(object):
|
||||
"""Auth container to pass CloudFiles storage URL and token from
|
||||
session.
|
||||
"""
|
||||
def __init__(self, storage_url, auth_token):
|
||||
self.storage_url = storage_url
|
||||
self.auth_token = auth_token
|
||||
|
||||
def authenticate(self):
|
||||
return (self.storage_url, '', self.auth_token)
|
||||
|
||||
|
||||
def url_for(request, service_name, admin=False):
|
||||
catalog = request.user.service_catalog
|
||||
if admin:
|
||||
@ -309,11 +321,13 @@ def auth_api():
|
||||
management_url=settings.OPENSTACK_KEYSTONE_URL)
|
||||
|
||||
|
||||
def swift_api():
|
||||
return cloudfiles.get_connection(
|
||||
settings.SWIFT_ACCOUNT + ":" + settings.SWIFT_USER,
|
||||
settings.SWIFT_PASS,
|
||||
authurl=settings.SWIFT_AUTHURL)
|
||||
def swift_api(request):
|
||||
LOG.debug('object store connection created using token "%s"'
|
||||
' and url "%s"' %
|
||||
(request.session['token'], url_for(request, 'swift')))
|
||||
auth = SwiftAuthentication(url_for(request, 'swift'),
|
||||
request.session['token'])
|
||||
return cloudfiles.get_connection(auth=auth)
|
||||
|
||||
|
||||
def console_create(request, instance_id, kind='text'):
|
||||
@ -523,16 +537,16 @@ def user_update_tenant(request, user_id, tenant_id):
|
||||
return User(account_api(request).users.update_tenant(user_id, tenant_id))
|
||||
|
||||
|
||||
def swift_container_exists(container_name):
|
||||
def swift_container_exists(request, container_name):
|
||||
try:
|
||||
swift_api().get_container(container_name)
|
||||
swift_api(request).get_container(container_name)
|
||||
return True
|
||||
except cloudfiles.errors.NoSuchContainer:
|
||||
return False
|
||||
|
||||
|
||||
def swift_object_exists(container_name, object_name):
|
||||
container = swift_api().get_container(container_name)
|
||||
def swift_object_exists(request, container_name, object_name):
|
||||
container = swift_api(request).get_container(container_name)
|
||||
|
||||
try:
|
||||
container.get_object(object_name)
|
||||
@ -541,32 +555,34 @@ def swift_object_exists(container_name, object_name):
|
||||
return False
|
||||
|
||||
|
||||
def swift_get_containers():
|
||||
return [Container(c) for c in swift_api().get_all_containers()]
|
||||
def swift_get_containers(request):
|
||||
return [Container(c) for c in swift_api(request).get_all_containers()]
|
||||
|
||||
|
||||
def swift_create_container(name):
|
||||
if swift_container_exists(name):
|
||||
def swift_create_container(request, name):
|
||||
if swift_container_exists(request, name):
|
||||
raise Exception('Container with name %s already exists.' % (name))
|
||||
|
||||
return Container(swift_api().create_container(name))
|
||||
return Container(swift_api(request).create_container(name))
|
||||
|
||||
|
||||
def swift_delete_container(name):
|
||||
swift_api().delete_container(name)
|
||||
def swift_delete_container(request, name):
|
||||
swift_api(request).delete_container(name)
|
||||
|
||||
|
||||
def swift_get_objects(container_name, prefix=None):
|
||||
container = swift_api().get_container(container_name)
|
||||
def swift_get_objects(request, container_name, prefix=None):
|
||||
container = swift_api(request).get_container(container_name)
|
||||
return [SwiftObject(o) for o in container.get_objects(prefix=prefix)]
|
||||
|
||||
|
||||
def swift_copy_object(orig_container_name, orig_object_name,
|
||||
def swift_copy_object(request, orig_container_name, orig_object_name,
|
||||
new_container_name, new_object_name):
|
||||
|
||||
container = swift_api().get_container(orig_container_name)
|
||||
container = swift_api(request).get_container(orig_container_name)
|
||||
|
||||
if swift_object_exists(new_container_name, new_object_name) == True:
|
||||
if swift_object_exists(request,
|
||||
new_container_name,
|
||||
new_object_name) == True:
|
||||
raise Exception('Object with name %s already exists in container %s'
|
||||
% (new_object_name, new_container_name))
|
||||
|
||||
@ -574,17 +590,17 @@ def swift_copy_object(orig_container_name, orig_object_name,
|
||||
return orig_obj.copy_to(new_container_name, new_object_name)
|
||||
|
||||
|
||||
def swift_upload_object(container_name, object_name, object_data):
|
||||
container = swift_api().get_container(container_name)
|
||||
def swift_upload_object(request, container_name, object_name, object_data):
|
||||
container = swift_api(request).get_container(container_name)
|
||||
obj = container.create_object(object_name)
|
||||
obj.write(object_data)
|
||||
|
||||
|
||||
def swift_delete_object(container_name, object_name):
|
||||
container = swift_api().get_container(container_name)
|
||||
def swift_delete_object(request, container_name, object_name):
|
||||
container = swift_api(request).get_container(container_name)
|
||||
container.delete_object(object_name)
|
||||
|
||||
|
||||
def swift_get_object_data(container_name, object_name):
|
||||
container = swift_api().get_container(container_name)
|
||||
def swift_get_object_data(request, container_name, object_name):
|
||||
container = swift_api(request).get_container(container_name)
|
||||
return container.get_object(object_name).stream()
|
||||
|
@ -37,4 +37,4 @@ def tenants(request):
|
||||
|
||||
|
||||
def swift(request):
|
||||
return {'swift_configured': hasattr(settings, "SWIFT_AUTHURL")}
|
||||
return {'swift_configured': settings.SWIFT_ENABLED}
|
||||
|
@ -42,7 +42,7 @@ class DeleteContainer(forms.SelfHandlingForm):
|
||||
|
||||
def handle(self, request, data):
|
||||
try:
|
||||
api.swift_delete_container(data['container_name'])
|
||||
api.swift_delete_container(request, data['container_name'])
|
||||
except ContainerNotEmpty, e:
|
||||
messages.error(request,
|
||||
'Unable to delete non-empty container: %s' % \
|
||||
@ -60,7 +60,7 @@ class CreateContainer(forms.SelfHandlingForm):
|
||||
name = forms.CharField(max_length="255", label="Container Name")
|
||||
|
||||
def handle(self, request, data):
|
||||
api.swift_create_container(data['name'])
|
||||
api.swift_create_container(request, data['name'])
|
||||
messages.success(request, "Container was successfully created.")
|
||||
return shortcuts.redirect(request.build_absolute_uri())
|
||||
|
||||
@ -71,7 +71,7 @@ def index(request, tenant_id):
|
||||
if handled:
|
||||
return handled
|
||||
|
||||
containers = api.swift_get_containers()
|
||||
containers = api.swift_get_containers(request)
|
||||
|
||||
return shortcuts.render_to_response('dash_containers.html', {
|
||||
'containers': containers,
|
||||
|
@ -44,7 +44,8 @@ class FilterObjects(forms.SelfHandlingForm):
|
||||
def handle(self, request, data):
|
||||
object_prefix = data['object_prefix'] or None
|
||||
|
||||
objects = api.swift_get_objects(data['container_name'],
|
||||
objects = api.swift_get_objects(request,
|
||||
data['container_name'],
|
||||
prefix=object_prefix)
|
||||
|
||||
return objects
|
||||
@ -56,6 +57,7 @@ class DeleteObject(forms.SelfHandlingForm):
|
||||
|
||||
def handle(self, request, data):
|
||||
api.swift_delete_object(
|
||||
request,
|
||||
data['container_name'],
|
||||
data['object_name'])
|
||||
messages.info(request,
|
||||
@ -71,6 +73,7 @@ class UploadObject(forms.SelfHandlingForm):
|
||||
|
||||
def handle(self, request, data):
|
||||
api.swift_upload_object(
|
||||
request,
|
||||
data['container_name'],
|
||||
data['name'],
|
||||
self.files['object_file'].read())
|
||||
@ -89,11 +92,11 @@ class CopyObject(forms.SelfHandlingForm):
|
||||
orig_object_name = forms.CharField(widget=forms.HiddenInput())
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
containers = kwargs.pop('containers')
|
||||
|
||||
super(CopyObject, self).__init__(*args, **kwargs)
|
||||
|
||||
container_choices = \
|
||||
[(c.name, c.name) for c in api.swift_get_containers()]
|
||||
self.fields['new_container_name'].choices = container_choices
|
||||
self.fields['new_container_name'].choices = containers
|
||||
|
||||
def handle(self, request, data):
|
||||
orig_container_name = data['orig_container_name']
|
||||
@ -101,8 +104,9 @@ class CopyObject(forms.SelfHandlingForm):
|
||||
new_container_name = data['new_container_name']
|
||||
new_object_name = data['new_object_name']
|
||||
|
||||
api.swift_copy_object(orig_container_name, orig_object_name,
|
||||
new_container_name, new_object_name)
|
||||
api.swift_copy_object(request, orig_container_name,
|
||||
orig_object_name, new_container_name,
|
||||
new_object_name)
|
||||
|
||||
messages.success(request,
|
||||
'Object was successfully copied to %s\%s' %
|
||||
@ -120,7 +124,7 @@ def index(request, tenant_id, container_name):
|
||||
filter_form, objects = FilterObjects.maybe_handle(request)
|
||||
if not objects:
|
||||
filter_form.fields['container_name'].initial = container_name
|
||||
objects = api.swift_get_objects(container_name)
|
||||
objects = api.swift_get_objects(request, container_name)
|
||||
|
||||
delete_form.fields['container_name'].initial = container_name
|
||||
return render_to_response('dash_objects.html', {
|
||||
@ -147,7 +151,7 @@ def upload(request, tenant_id, container_name):
|
||||
@login_required
|
||||
def download(request, tenant_id, container_name, object_name):
|
||||
object_data = api.swift_get_object_data(
|
||||
container_name, object_name)
|
||||
request, container_name, object_name)
|
||||
|
||||
response = http.HttpResponse()
|
||||
response['Content-Disposition'] = 'attachment; filename=%s' % \
|
||||
@ -159,7 +163,11 @@ def download(request, tenant_id, container_name, object_name):
|
||||
|
||||
@login_required
|
||||
def copy(request, tenant_id, container_name, object_name):
|
||||
form, handled = CopyObject.maybe_handle(request)
|
||||
containers = \
|
||||
[(c.name, c.name) for c in api.swift_get_containers(
|
||||
request)]
|
||||
form, handled = CopyObject.maybe_handle(request,
|
||||
containers=containers)
|
||||
|
||||
if handled:
|
||||
return handled
|
||||
|
@ -1263,28 +1263,23 @@ class GlanceApiTests(test.TestCase):
|
||||
|
||||
|
||||
class SwiftApiTests(test.TestCase):
|
||||
def setUp(self):
|
||||
self.mox = mox.Mox()
|
||||
|
||||
self.request = http.HttpRequest()
|
||||
self.request.session = dict()
|
||||
self.request.session['token'] = TEST_TOKEN
|
||||
|
||||
def tearDown(self):
|
||||
self.mox.UnsetStubs()
|
||||
|
||||
def stub_swift_api(self, count=1):
|
||||
self.mox.StubOutWithMock(api, 'swift_api')
|
||||
swift_api = self.mox.CreateMock(cloudfiles.connection.Connection)
|
||||
for i in range(count):
|
||||
api.swift_api().AndReturn(swift_api)
|
||||
api.swift_api(IsA(http.HttpRequest)).AndReturn(swift_api)
|
||||
return swift_api
|
||||
|
||||
def test_get_swift_api(self):
|
||||
self.mox.StubOutWithMock(cloudfiles, 'get_connection')
|
||||
|
||||
swiftuser = ':'.join((settings.SWIFT_ACCOUNT, settings.SWIFT_USER))
|
||||
cloudfiles.get_connection(swiftuser,
|
||||
settings.SWIFT_PASS,
|
||||
authurl=settings.SWIFT_AUTHURL
|
||||
).AndReturn(TEST_RETURN)
|
||||
|
||||
self.mox.ReplayAll()
|
||||
|
||||
self.assertEqual(api.swift_api(), TEST_RETURN)
|
||||
|
||||
self.mox.VerifyAll()
|
||||
|
||||
def test_swift_get_containers(self):
|
||||
containers = (TEST_RETURN, TEST_RETURN + '2')
|
||||
|
||||
@ -1294,7 +1289,7 @@ class SwiftApiTests(test.TestCase):
|
||||
|
||||
self.mox.ReplayAll()
|
||||
|
||||
ret_val = api.swift_get_containers()
|
||||
ret_val = api.swift_get_containers(self.request)
|
||||
|
||||
self.assertEqual(len(ret_val), len(containers))
|
||||
for container in ret_val:
|
||||
@ -1309,12 +1304,13 @@ class SwiftApiTests(test.TestCase):
|
||||
swift_api = self.stub_swift_api()
|
||||
self.mox.StubOutWithMock(api, 'swift_container_exists')
|
||||
|
||||
api.swift_container_exists(NAME).AndReturn(False)
|
||||
api.swift_container_exists(self.request,
|
||||
NAME).AndReturn(False)
|
||||
swift_api.create_container(NAME).AndReturn(TEST_RETURN)
|
||||
|
||||
self.mox.ReplayAll()
|
||||
|
||||
ret_val = api.swift_create_container(NAME)
|
||||
ret_val = api.swift_create_container(self.request, NAME)
|
||||
|
||||
self.assertIsInstance(ret_val, api.Container)
|
||||
self.assertEqual(ret_val._apiresource, TEST_RETURN)
|
||||
@ -1330,7 +1326,7 @@ class SwiftApiTests(test.TestCase):
|
||||
|
||||
self.mox.ReplayAll()
|
||||
|
||||
ret_val = api.swift_delete_container(NAME)
|
||||
ret_val = api.swift_delete_container(self.request, NAME)
|
||||
|
||||
self.assertIsNone(ret_val)
|
||||
|
||||
@ -1349,7 +1345,7 @@ class SwiftApiTests(test.TestCase):
|
||||
|
||||
self.mox.ReplayAll()
|
||||
|
||||
ret_val = api.swift_get_objects(NAME)
|
||||
ret_val = api.swift_get_objects(self.request, NAME)
|
||||
|
||||
self.assertEqual(len(ret_val), len(swift_objects))
|
||||
for swift_object in ret_val:
|
||||
@ -1372,7 +1368,9 @@ class SwiftApiTests(test.TestCase):
|
||||
|
||||
self.mox.ReplayAll()
|
||||
|
||||
ret_val = api.swift_get_objects(NAME, prefix=PREFIX)
|
||||
ret_val = api.swift_get_objects(self.request,
|
||||
NAME,
|
||||
prefix=PREFIX)
|
||||
|
||||
self.assertEqual(len(ret_val), len(swift_objects))
|
||||
for swift_object in ret_val:
|
||||
@ -1396,7 +1394,9 @@ class SwiftApiTests(test.TestCase):
|
||||
|
||||
self.mox.ReplayAll()
|
||||
|
||||
ret_val = api.swift_upload_object(CONTAINER_NAME, OBJECT_NAME,
|
||||
ret_val = api.swift_upload_object(self.request,
|
||||
CONTAINER_NAME,
|
||||
OBJECT_NAME,
|
||||
OBJECT_DATA)
|
||||
|
||||
self.assertIsNone(ret_val)
|
||||
@ -1415,7 +1415,9 @@ class SwiftApiTests(test.TestCase):
|
||||
|
||||
self.mox.ReplayAll()
|
||||
|
||||
ret_val = api.swift_delete_object(CONTAINER_NAME, OBJECT_NAME)
|
||||
ret_val = api.swift_delete_object(self.request,
|
||||
CONTAINER_NAME,
|
||||
OBJECT_NAME)
|
||||
|
||||
self.assertIsNone(ret_val)
|
||||
|
||||
@ -1436,7 +1438,9 @@ class SwiftApiTests(test.TestCase):
|
||||
|
||||
self.mox.ReplayAll()
|
||||
|
||||
ret_val = api.swift_get_object_data(CONTAINER_NAME, OBJECT_NAME)
|
||||
ret_val = api.swift_get_object_data(self.request,
|
||||
CONTAINER_NAME,
|
||||
OBJECT_NAME)
|
||||
|
||||
self.assertEqual(ret_val, OBJECT_DATA)
|
||||
|
||||
@ -1455,7 +1459,9 @@ class SwiftApiTests(test.TestCase):
|
||||
|
||||
self.mox.ReplayAll()
|
||||
|
||||
ret_val = api.swift_object_exists(CONTAINER_NAME, OBJECT_NAME)
|
||||
ret_val = api.swift_object_exists(self.request,
|
||||
CONTAINER_NAME,
|
||||
OBJECT_NAME)
|
||||
self.assertTrue(ret_val)
|
||||
|
||||
self.mox.VerifyAll()
|
||||
@ -1471,15 +1477,18 @@ class SwiftApiTests(test.TestCase):
|
||||
swift_object = self.mox.CreateMock(cloudfiles.Object)
|
||||
|
||||
swift_api.get_container(CONTAINER_NAME).AndReturn(container)
|
||||
api.swift_object_exists(CONTAINER_NAME, OBJECT_NAME).AndReturn(False)
|
||||
api.swift_object_exists(self.request,
|
||||
CONTAINER_NAME,
|
||||
OBJECT_NAME).AndReturn(False)
|
||||
|
||||
container.get_object(OBJECT_NAME).AndReturn(swift_object)
|
||||
swift_object.copy_to(CONTAINER_NAME, OBJECT_NAME)
|
||||
|
||||
self.mox.ReplayAll()
|
||||
|
||||
ret_val = api.swift_copy_object(CONTAINER_NAME, OBJECT_NAME,
|
||||
CONTAINER_NAME, OBJECT_NAME)
|
||||
ret_val = api.swift_copy_object(self.request, CONTAINER_NAME,
|
||||
OBJECT_NAME, CONTAINER_NAME,
|
||||
OBJECT_NAME)
|
||||
|
||||
self.assertIsNone(ret_val)
|
||||
self.mox.VerifyAll()
|
||||
|
@ -1,4 +1,5 @@
|
||||
from cloudfiles.errors import ContainerNotEmpty
|
||||
from django import http
|
||||
from django.contrib import messages
|
||||
from django.core.urlresolvers import reverse
|
||||
from django_openstack import api
|
||||
@ -15,7 +16,8 @@ class ContainerViewTests(base.BaseViewTests):
|
||||
|
||||
def test_index(self):
|
||||
self.mox.StubOutWithMock(api, 'swift_get_containers')
|
||||
api.swift_get_containers().AndReturn([self.container])
|
||||
api.swift_get_containers(
|
||||
IsA(http.HttpRequest)).AndReturn([self.container])
|
||||
|
||||
self.mox.ReplayAll()
|
||||
|
||||
@ -35,7 +37,8 @@ class ContainerViewTests(base.BaseViewTests):
|
||||
'method': 'DeleteContainer'}
|
||||
|
||||
self.mox.StubOutWithMock(api, 'swift_delete_container')
|
||||
api.swift_delete_container('containerName')
|
||||
api.swift_delete_container(IsA(http.HttpRequest),
|
||||
'containerName')
|
||||
|
||||
self.mox.ReplayAll()
|
||||
|
||||
@ -54,7 +57,9 @@ class ContainerViewTests(base.BaseViewTests):
|
||||
exception = ContainerNotEmpty('containerNotEmpty')
|
||||
|
||||
self.mox.StubOutWithMock(api, 'swift_delete_container')
|
||||
api.swift_delete_container('containerName').AndRaise(exception)
|
||||
api.swift_delete_container(
|
||||
IsA(http.HttpRequest),
|
||||
'containerName').AndRaise(exception)
|
||||
|
||||
self.mox.StubOutWithMock(messages, 'error')
|
||||
|
||||
@ -81,7 +86,8 @@ class ContainerViewTests(base.BaseViewTests):
|
||||
'method': 'CreateContainer'}
|
||||
|
||||
self.mox.StubOutWithMock(api, 'swift_create_container')
|
||||
api.swift_create_container('CreateContainer')
|
||||
api.swift_create_container(
|
||||
IsA(http.HttpRequest), 'CreateContainer')
|
||||
|
||||
self.mox.StubOutWithMock(messages, 'success')
|
||||
messages.success(IgnoreArg(), IsA(str))
|
||||
|
@ -1,9 +1,10 @@
|
||||
import tempfile
|
||||
|
||||
from django import http
|
||||
from django.core.urlresolvers import reverse
|
||||
from django_openstack import api
|
||||
from django_openstack.tests.view_tests import base
|
||||
|
||||
from mox import IsA
|
||||
|
||||
class ObjectViewTests(base.BaseViewTests):
|
||||
CONTAINER_NAME = 'containerName'
|
||||
@ -16,6 +17,7 @@ class ObjectViewTests(base.BaseViewTests):
|
||||
def test_index(self):
|
||||
self.mox.StubOutWithMock(api, 'swift_get_objects')
|
||||
api.swift_get_objects(
|
||||
IsA(http.HttpRequest),
|
||||
self.CONTAINER_NAME).AndReturn(self.swift_objects)
|
||||
|
||||
self.mox.ReplayAll()
|
||||
@ -49,7 +51,8 @@ class ObjectViewTests(base.BaseViewTests):
|
||||
'object_file': OBJECT_FILE}
|
||||
|
||||
self.mox.StubOutWithMock(api, 'swift_upload_object')
|
||||
api.swift_upload_object(unicode(self.CONTAINER_NAME),
|
||||
api.swift_upload_object(IsA(http.HttpRequest),
|
||||
unicode(self.CONTAINER_NAME),
|
||||
unicode(OBJECT_NAME),
|
||||
OBJECT_DATA)
|
||||
|
||||
@ -73,7 +76,9 @@ class ObjectViewTests(base.BaseViewTests):
|
||||
'object_name': OBJECT_NAME}
|
||||
|
||||
self.mox.StubOutWithMock(api, 'swift_delete_object')
|
||||
api.swift_delete_object(self.CONTAINER_NAME, OBJECT_NAME)
|
||||
api.swift_delete_object(
|
||||
IsA(http.HttpRequest),
|
||||
self.CONTAINER_NAME, OBJECT_NAME)
|
||||
|
||||
self.mox.ReplayAll()
|
||||
|
||||
@ -93,7 +98,8 @@ class ObjectViewTests(base.BaseViewTests):
|
||||
OBJECT_NAME = 'objectName'
|
||||
|
||||
self.mox.StubOutWithMock(api, 'swift_get_object_data')
|
||||
api.swift_get_object_data(unicode(self.CONTAINER_NAME),
|
||||
api.swift_get_object_data(IsA(http.HttpRequest),
|
||||
unicode(self.CONTAINER_NAME),
|
||||
unicode(OBJECT_NAME)).AndReturn(OBJECT_DATA)
|
||||
|
||||
self.mox.ReplayAll()
|
||||
@ -115,7 +121,8 @@ class ObjectViewTests(base.BaseViewTests):
|
||||
container.name = self.CONTAINER_NAME
|
||||
|
||||
self.mox.StubOutWithMock(api, 'swift_get_containers')
|
||||
api.swift_get_containers().AndReturn([container])
|
||||
api.swift_get_containers(
|
||||
IsA(http.HttpRequest)).AndReturn([container])
|
||||
|
||||
self.mox.ReplayAll()
|
||||
|
||||
@ -144,11 +151,15 @@ class ObjectViewTests(base.BaseViewTests):
|
||||
container.name = self.CONTAINER_NAME
|
||||
|
||||
self.mox.StubOutWithMock(api, 'swift_get_containers')
|
||||
api.swift_get_containers().AndReturn([container])
|
||||
api.swift_get_containers(
|
||||
IsA(http.HttpRequest)).AndReturn([container])
|
||||
|
||||
self.mox.StubOutWithMock(api, 'swift_copy_object')
|
||||
api.swift_copy_object(ORIG_CONTAINER_NAME, ORIG_OBJECT_NAME,
|
||||
NEW_CONTAINER_NAME, NEW_OBJECT_NAME)
|
||||
api.swift_copy_object(IsA(http.HttpRequest),
|
||||
ORIG_CONTAINER_NAME,
|
||||
ORIG_OBJECT_NAME,
|
||||
NEW_CONTAINER_NAME,
|
||||
NEW_OBJECT_NAME)
|
||||
|
||||
self.mox.ReplayAll()
|
||||
|
||||
@ -174,7 +185,8 @@ class ObjectViewTests(base.BaseViewTests):
|
||||
}
|
||||
|
||||
self.mox.StubOutWithMock(api, 'swift_get_objects')
|
||||
api.swift_get_objects(unicode(self.CONTAINER_NAME),
|
||||
api.swift_get_objects(IsA(http.HttpRequest),
|
||||
unicode(self.CONTAINER_NAME),
|
||||
prefix=unicode(PREFIX)
|
||||
).AndReturn(self.swift_objects)
|
||||
|
||||
|
@ -121,4 +121,12 @@ except Exception, e:
|
||||
if DEBUG:
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
|
||||
try:
|
||||
import debug_toolbar
|
||||
|
||||
INSTALLED_APPS += ('debug_toolbar',)
|
||||
MIDDLEWARE_CLASSES += ('debug_toolbar.middleware.DebugToolbarMiddleware',)
|
||||
except ImportError:
|
||||
logging.info('Running in debug mode without debug_toolbar.')
|
||||
|
||||
OPENSTACK_KEYSTONE_DEFAULT_ROLE='Member'
|
||||
|
@ -35,12 +35,9 @@ OPENSTACK_ADMIN_TOKEN = "999888777666"
|
||||
OPENSTACK_KEYSTONE_URL = "http://localhost:5000/v2.0/"
|
||||
OPENSTACK_KEYSTONE_DEFAULT_ROLE = "Member"
|
||||
|
||||
# NOTE(tres): Replace all of this nonsense once Swift+Keystone
|
||||
# is stable.
|
||||
# SWIFT_AUTHURL = 'http://localhost:8080/auth/v1.0'
|
||||
# SWIFT_ACCOUNT = 'test'
|
||||
# SWIFT_USER = 'tester'
|
||||
# SWIFT_PASS = 'testing'
|
||||
# NOTE(tres): Available services should come from the service
|
||||
# catalog in Keystone.
|
||||
SWIFT_ENABLED = False
|
||||
|
||||
# If you have external monitoring links
|
||||
EXTERNAL_MONITORING = [
|
||||
|
Loading…
x
Reference in New Issue
Block a user