Merge pull request #158 from gabrielhurley/fix_unittests_post_localization

Fixes all failing unit tests post localization merge. :-/
This commit is contained in:
Devin Carlen 2011-10-19 15:22:34 -07:00
commit 045b1b08b6
9 changed files with 26 additions and 27 deletions

View File

@ -113,7 +113,7 @@ class UpdateInstance(forms.SelfHandlingForm):
@login_required
def index(request, tenant_id):
for f in (TerminateInstance, RebootInstance):
_, handled = f.maybe_handle(request)
form, handled = f.maybe_handle(request)
if handled:
return handled
instances = []
@ -121,8 +121,7 @@ def index(request, tenant_id):
instances = api.server_list(request)
except api_exceptions.ApiException as e:
LOG.exception('Exception in instance index')
messages.error(request,
_('Unable to get instance list: %s') % e.message)
messages.error(request, _('Unable to get instance list: %s') % e.message)
# We don't have any way of showing errors for these, so don't bother
# trying to reuse the forms from above
@ -251,7 +250,7 @@ def vnc(request, tenant_id, instance_id):
LOG.exception('ApiException while fetching instance vnc connection')
messages.error(request,
_('Unable to get vnc console for instance %(inst)s: %(message)s') %
{"inst": instance_id, "massage": e.message})
{"inst": instance_id, "message": e.message})
return shortcuts.redirect('dash_instances', tenant_id)
@ -263,7 +262,7 @@ def update(request, tenant_id, instance_id):
LOG.exception('ApiException while fetching instance info')
messages.error(request,
_('Unable to get information for instance %(inst)s: %(message)s') %
{"inst": instance_id, "massage": e.message})
{"inst": instance_id, "message": e.message})
return shortcuts.redirect('dash_instances', tenant_id)
form, handled = UpdateInstance.maybe_handle(request, initial={

View File

@ -111,7 +111,7 @@ class ContainerViewTests(base.BaseViewTests):
IsA(http.HttpRequest), 'CreateContainer')
self.mox.StubOutWithMock(messages, 'success')
messages.success(IgnoreArg(), IsA(str))
messages.success(IgnoreArg(), IsA(basestring))
res = self.client.post(reverse('dash_containers_create',
args=[self.request.user.tenant_id]),

View File

@ -138,7 +138,7 @@ class FloatingIpViewTests(base.BaseViewTests):
AndRaise(exception)
self.mox.StubOutWithMock(messages, 'error')
messages.error(IsA(http.HttpRequest), IsA(str))
messages.error(IsA(http.HttpRequest), IsA(basestring))
self.mox.StubOutWithMock(api, 'tenant_floating_ip_get')
api.tenant_floating_ip_get = self.mox.CreateMockAnything()
@ -204,7 +204,7 @@ class FloatingIpViewTests(base.BaseViewTests):
IsA(int)).\
AndRaise(exception)
self.mox.StubOutWithMock(messages, 'error')
messages.error(IsA(http.HttpRequest), IsA(str))
messages.error(IsA(http.HttpRequest), IsA(basestring))
self.mox.StubOutWithMock(api, 'tenant_floating_ip_get')
api.tenant_floating_ip_get = self.mox.CreateMockAnything()

View File

@ -90,7 +90,7 @@ class ImageViewTests(base.BaseViewTests):
api.image_list_detailed(IsA(http.HttpRequest)).AndReturn([])
self.mox.StubOutWithMock(messages, 'info')
messages.info(IsA(http.HttpRequest), IsA(str))
messages.info(IsA(http.HttpRequest), IsA(basestring))
self.mox.ReplayAll()
@ -110,7 +110,7 @@ class ImageViewTests(base.BaseViewTests):
api.image_list_detailed(IsA(http.HttpRequest)).AndRaise(exception)
self.mox.StubOutWithMock(messages, 'error')
messages.error(IsA(http.HttpRequest), IsA(str))
messages.error(IsA(http.HttpRequest), IsA(basestring))
self.mox.ReplayAll()
@ -130,7 +130,7 @@ class ImageViewTests(base.BaseViewTests):
api.image_list_detailed(IsA(http.HttpRequest)).AndRaise(exception)
self.mox.StubOutWithMock(messages, 'error')
messages.error(IsA(http.HttpRequest), IsA(str))
messages.error(IsA(http.HttpRequest), IsA(basestring))
self.mox.ReplayAll()
@ -244,7 +244,7 @@ class ImageViewTests(base.BaseViewTests):
KEY_NAME, USER_DATA, [self.security_groups[0].name])
self.mox.StubOutWithMock(messages, 'success')
messages.success(IsA(http.HttpRequest), IsA(str))
messages.success(IsA(http.HttpRequest), IsA(basestring))
self.mox.ReplayAll()
@ -395,7 +395,7 @@ class ImageViewTests(base.BaseViewTests):
self.security_groups).AndRaise(exception)
self.mox.StubOutWithMock(messages, 'error')
messages.error(IsA(http.HttpRequest), IsA(str))
messages.error(IsA(http.HttpRequest), IsA(basestring))
self.mox.ReplayAll()
url = reverse('dash_images_launch',

View File

@ -153,7 +153,7 @@ class InstanceViewTests(base.BaseViewTests):
unicode(self.servers[0].id)).AndRaise(exception)
self.mox.StubOutWithMock(messages, 'error')
messages.error(IsA(http.HttpRequest), IsA(str))
messages.error(IsA(http.HttpRequest), IsA(basestring))
self.mox.ReplayAll()
@ -241,7 +241,7 @@ class InstanceViewTests(base.BaseViewTests):
now).AndRaise(exception)
self.mox.StubOutWithMock(messages, 'error')
messages.error(IsA(http.HttpRequest), IsA(str))
messages.error(IsA(http.HttpRequest), IsA(basestring))
self.mox.ReplayAll()

View File

@ -57,7 +57,7 @@ class KeyPairViewTests(base.BaseViewTests):
api.keypair_list(IsA(http.HttpRequest)).AndRaise(exception)
self.mox.StubOutWithMock(messages, 'error')
messages.error(IsA(http.HttpRequest), IsA(str))
messages.error(IsA(http.HttpRequest), IsA(basestring))
self.mox.ReplayAll()

View File

@ -40,7 +40,7 @@ class PortViewTests(base.BaseViewTests):
'method': 'CreatePort'}
self.mox.StubOutWithMock(messages, 'success')
messages.success(IgnoreArg(), IsA(str))
messages.success(IgnoreArg(), IsA(basestring))
res = self.client.post(reverse('dash_ports_create',
args=[self.request.user.tenant_id, "n1"]),
@ -60,7 +60,7 @@ class PortViewTests(base.BaseViewTests):
'method': 'DeletePort'}
self.mox.StubOutWithMock(messages, 'success')
messages.success(IgnoreArg(), IsA(str))
messages.success(IgnoreArg(), IsA(basestring))
res = self.client.post(reverse('dash_networks_detail',
args=[self.request.user.tenant_id, "n1"]),
@ -77,7 +77,7 @@ class PortViewTests(base.BaseViewTests):
'method': 'AttachPort'}
self.mox.StubOutWithMock(messages, 'success')
messages.success(IgnoreArg(), IsA(str))
messages.success(IgnoreArg(), IsA(basestring))
res = self.client.post(reverse('dash_ports_attach',
args=[self.request.user.tenant_id, "n1", "p1"]),
@ -97,7 +97,7 @@ class PortViewTests(base.BaseViewTests):
'method': 'DetachPort'}
self.mox.StubOutWithMock(messages, 'success')
messages.success(IgnoreArg(), IsA(str))
messages.success(IgnoreArg(), IsA(basestring))
res = self.client.post(reverse('dash_networks_detail',
args=[self.request.user.tenant_id, "n1"]),

View File

@ -61,7 +61,7 @@ class SecurityGroupsViewTests(base.BaseViewTests):
api.security_group_list(IsA(http.HttpRequest)).AndRaise(exception)
self.mox.StubOutWithMock(messages, 'error')
messages.error(IsA(http.HttpRequest), IsA(str))
messages.error(IsA(http.HttpRequest), IsA(basestring))
self.mox.ReplayAll()
@ -206,7 +206,7 @@ class SecurityGroupsViewTests(base.BaseViewTests):
.AndReturn(new_rule)
self.mox.StubOutWithMock(messages, 'info')
messages.info(IsA(http.HttpRequest), IsA(str))
messages.info(IsA(http.HttpRequest), IsA(basestring))
self.mox.ReplayAll()
@ -245,7 +245,7 @@ class SecurityGroupsViewTests(base.BaseViewTests):
TO_PORT, CIDR).AndRaise(exception)
self.mox.StubOutWithMock(messages, 'error')
messages.error(IsA(http.HttpRequest), IsA(str))
messages.error(IsA(http.HttpRequest), IsA(basestring))
self.mox.ReplayAll()
@ -303,7 +303,7 @@ class SecurityGroupsViewTests(base.BaseViewTests):
AndRaise(exception)
self.mox.StubOutWithMock(messages, 'error')
messages.error(IsA(http.HttpRequest), IsA(str))
messages.error(IsA(http.HttpRequest), IsA(basestring))
self.mox.ReplayAll()
@ -358,7 +358,7 @@ class SecurityGroupsViewTests(base.BaseViewTests):
AndRaise(exception)
self.mox.StubOutWithMock(messages, 'error')
messages.error(IsA(http.HttpRequest), IsA(str))
messages.error(IsA(http.HttpRequest), IsA(basestring))
self.mox.ReplayAll()

View File

@ -72,7 +72,7 @@ class SnapshotsViewTests(base.BaseViewTests):
api.snapshot_list_detailed(IsA(http.HttpRequest)).AndRaise(exception)
self.mox.StubOutWithMock(messages, 'error')
messages.error(IsA(http.HttpRequest), IsA(str))
messages.error(IsA(http.HttpRequest), IsA(basestring))
self.mox.ReplayAll()
@ -90,7 +90,7 @@ class SnapshotsViewTests(base.BaseViewTests):
api.snapshot_list_detailed(IsA(http.HttpRequest)).AndRaise(exception)
self.mox.StubOutWithMock(messages, 'error')
messages.error(IsA(http.HttpRequest), IsA(str))
messages.error(IsA(http.HttpRequest), IsA(basestring))
self.mox.ReplayAll()