From fc9897e2ad3c5b308784b05f8f4d57b7d91dc989 Mon Sep 17 00:00:00 2001 From: Gabriel Hurley Date: Wed, 19 Oct 2011 15:09:50 -0700 Subject: [PATCH] Fixes all failing unit tests post localization merge. :-/ --- .../django_openstack/dash/views/instances.py | 9 ++++----- .../tests/view_tests/dash/container_tests.py | 2 +- .../tests/view_tests/dash/floating_ip_tests.py | 4 ++-- .../tests/view_tests/dash/images_tests.py | 10 +++++----- .../tests/view_tests/dash/instance_tests.py | 4 ++-- .../tests/view_tests/dash/keypair_tests.py | 2 +- .../tests/view_tests/dash/port_tests.py | 8 ++++---- .../tests/view_tests/dash/security_groups_tests.py | 10 +++++----- .../tests/view_tests/dash/snapshots_tests.py | 4 ++-- 9 files changed, 26 insertions(+), 27 deletions(-) diff --git a/django-openstack/django_openstack/dash/views/instances.py b/django-openstack/django_openstack/dash/views/instances.py index d2105b68d9..2ee4ab0605 100644 --- a/django-openstack/django_openstack/dash/views/instances.py +++ b/django-openstack/django_openstack/dash/views/instances.py @@ -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={ diff --git a/django-openstack/django_openstack/tests/view_tests/dash/container_tests.py b/django-openstack/django_openstack/tests/view_tests/dash/container_tests.py index a27d4eb866..b1cb6fc9fc 100644 --- a/django-openstack/django_openstack/tests/view_tests/dash/container_tests.py +++ b/django-openstack/django_openstack/tests/view_tests/dash/container_tests.py @@ -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]), diff --git a/django-openstack/django_openstack/tests/view_tests/dash/floating_ip_tests.py b/django-openstack/django_openstack/tests/view_tests/dash/floating_ip_tests.py index 1de3318604..cd926ca111 100644 --- a/django-openstack/django_openstack/tests/view_tests/dash/floating_ip_tests.py +++ b/django-openstack/django_openstack/tests/view_tests/dash/floating_ip_tests.py @@ -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() diff --git a/django-openstack/django_openstack/tests/view_tests/dash/images_tests.py b/django-openstack/django_openstack/tests/view_tests/dash/images_tests.py index 42b4df8d14..b24fb4ab96 100644 --- a/django-openstack/django_openstack/tests/view_tests/dash/images_tests.py +++ b/django-openstack/django_openstack/tests/view_tests/dash/images_tests.py @@ -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', diff --git a/django-openstack/django_openstack/tests/view_tests/dash/instance_tests.py b/django-openstack/django_openstack/tests/view_tests/dash/instance_tests.py index fc03d11cc0..ed5812f71c 100644 --- a/django-openstack/django_openstack/tests/view_tests/dash/instance_tests.py +++ b/django-openstack/django_openstack/tests/view_tests/dash/instance_tests.py @@ -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() diff --git a/django-openstack/django_openstack/tests/view_tests/dash/keypair_tests.py b/django-openstack/django_openstack/tests/view_tests/dash/keypair_tests.py index 556cc1f1a9..45c090c9f8 100644 --- a/django-openstack/django_openstack/tests/view_tests/dash/keypair_tests.py +++ b/django-openstack/django_openstack/tests/view_tests/dash/keypair_tests.py @@ -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() diff --git a/django-openstack/django_openstack/tests/view_tests/dash/port_tests.py b/django-openstack/django_openstack/tests/view_tests/dash/port_tests.py index a220d549e2..5d5d827d5e 100644 --- a/django-openstack/django_openstack/tests/view_tests/dash/port_tests.py +++ b/django-openstack/django_openstack/tests/view_tests/dash/port_tests.py @@ -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"]), diff --git a/django-openstack/django_openstack/tests/view_tests/dash/security_groups_tests.py b/django-openstack/django_openstack/tests/view_tests/dash/security_groups_tests.py index 15eac3b27e..7d7bdee218 100644 --- a/django-openstack/django_openstack/tests/view_tests/dash/security_groups_tests.py +++ b/django-openstack/django_openstack/tests/view_tests/dash/security_groups_tests.py @@ -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() diff --git a/django-openstack/django_openstack/tests/view_tests/dash/snapshots_tests.py b/django-openstack/django_openstack/tests/view_tests/dash/snapshots_tests.py index d11bf224f0..7317ef7355 100644 --- a/django-openstack/django_openstack/tests/view_tests/dash/snapshots_tests.py +++ b/django-openstack/django_openstack/tests/view_tests/dash/snapshots_tests.py @@ -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()