Merge "Fix E127 errors in openstack_dashboard/dashboards/project/"

This commit is contained in:
Jenkins 2014-10-14 06:33:24 +00:00 committed by Gerrit Code Review
commit 5653f59737
34 changed files with 497 additions and 502 deletions

View File

@ -82,9 +82,9 @@ class FloatingIpViewTests(test.TestCase):
server = self.servers.first()
api.network.tenant_floating_ip_list(IsA(http.HttpRequest)) \
.AndReturn(self.floating_ips.list())
.AndReturn(self.floating_ips.list())
api.network.floating_ip_target_list(IsA(http.HttpRequest)) \
.AndReturn(self.servers.list())
.AndReturn(self.servers.list())
api.network.floating_ip_associate(IsA(http.HttpRequest),
floating_ip.id,
server.id)
@ -104,9 +104,9 @@ class FloatingIpViewTests(test.TestCase):
server = self.servers.first()
api.network.tenant_floating_ip_list(IsA(http.HttpRequest)) \
.AndReturn(self.floating_ips.list())
.AndReturn(self.floating_ips.list())
api.network.floating_ip_target_list(IsA(http.HttpRequest)) \
.AndReturn(self.servers.list())
.AndReturn(self.servers.list())
api.network.floating_ip_associate(IsA(http.HttpRequest),
floating_ip.id,
server.id)
@ -127,13 +127,13 @@ class FloatingIpViewTests(test.TestCase):
server = self.servers.first()
api.network.tenant_floating_ip_list(IsA(http.HttpRequest)) \
.AndReturn(self.floating_ips.list())
.AndReturn(self.floating_ips.list())
api.network.floating_ip_target_list(IsA(http.HttpRequest)) \
.AndReturn(self.servers.list())
.AndReturn(self.servers.list())
api.network.floating_ip_associate(IsA(http.HttpRequest),
floating_ip.id,
server.id) \
.AndRaise(self.exceptions.nova)
.AndRaise(self.exceptions.nova)
self.mox.ReplayAll()
form_data = {'instance_id': server.id,
@ -152,11 +152,11 @@ class FloatingIpViewTests(test.TestCase):
server = self.servers.first()
api.nova.server_list(IsA(http.HttpRequest)) \
.AndReturn([self.servers.list(), False])
.AndReturn([self.servers.list(), False])
api.network.floating_ip_supported(IsA(http.HttpRequest)) \
.AndReturn(True)
api.network.tenant_floating_ip_list(IsA(http.HttpRequest)) \
.AndReturn(self.floating_ips.list())
.AndReturn(self.floating_ips.list())
api.network.floating_ip_disassociate(IsA(http.HttpRequest),
floating_ip.id,
server.id)
@ -177,7 +177,7 @@ class FloatingIpViewTests(test.TestCase):
server = self.servers.first()
api.nova.server_list(IsA(http.HttpRequest)) \
.AndReturn([self.servers.list(), False])
.AndReturn([self.servers.list(), False])
api.network.floating_ip_supported(IsA(http.HttpRequest)) \
.AndReturn(True)
api.network.tenant_floating_ip_list(IsA(http.HttpRequest)) \

View File

@ -61,8 +61,9 @@ class ImportKeypair(forms.SelfHandlingForm):
keypair = api.nova.keypair_import(request,
data['name'],
data['public_key'])
messages.success(request, _('Successfully imported public key: %s')
% data['name'])
messages.success(request,
_('Successfully imported public key: %s')
% data['name'])
return keypair
except Exception:
exceptions.handle(request, ignore=True)

View File

@ -42,7 +42,7 @@ class KeyPairViewTests(test.TestCase):
api.network.floating_ip_supported(IsA(http.HttpRequest)) \
.AndReturn(True)
api.nova.keypair_list(IsA(http.HttpRequest)) \
.AndReturn(self.keypairs.list())
.AndReturn(self.keypairs.list())
api.nova.keypair_delete(IsA(http.HttpRequest), keypair.name)
self.mox.ReplayAll()
@ -60,9 +60,9 @@ class KeyPairViewTests(test.TestCase):
api.network.floating_ip_supported(IsA(http.HttpRequest)) \
.AndReturn(True)
api.nova.keypair_list(IsA(http.HttpRequest)) \
.AndReturn(self.keypairs.list())
.AndReturn(self.keypairs.list())
api.nova.keypair_delete(IsA(http.HttpRequest), keypair.name) \
.AndRaise(self.exceptions.nova)
.AndRaise(self.exceptions.nova)
self.mox.ReplayAll()
formData = {'action': 'keypairs__delete__%s' % keypair.name}
@ -139,7 +139,7 @@ class KeyPairViewTests(test.TestCase):
public_key = "ABCDEF"
api.nova.keypair_import(IsA(http.HttpRequest), key_name, public_key) \
.AndRaise(self.exceptions.nova)
.AndRaise(self.exceptions.nova)
self.mox.ReplayAll()
formData = {'method': 'ImportKeypair',
@ -169,7 +169,7 @@ class KeyPairViewTests(test.TestCase):
keypair = self.keypairs.first()
api.nova.keypair_create(IsA(http.HttpRequest), keypair.name) \
.AndRaise(self.exceptions.nova)
.AndRaise(self.exceptions.nova)
self.mox.ReplayAll()
context = {'keypair_name': keypair.name}

View File

@ -27,9 +27,9 @@ urlpatterns = patterns('',
url(r'^create/$', views.CreateView.as_view(), name='create'),
url(r'^import/$', views.ImportView.as_view(), name='import'),
url(r'^(?P<keypair_name>[^/]+)/download/$', views.DownloadView.as_view(),
name='download'),
name='download'),
url(r'^(?P<keypair_name>[^/]+)/generate/$', views.GenerateView.as_view(),
name='generate'),
name='generate'),
url(r'^(?P<keypair_name>[^/]+)/(?P<optional>[^/]+)/generate/$',
views.GenerateView.as_view(), name='generate'),
views.GenerateView.as_view(), name='generate'),
)

View File

@ -75,8 +75,8 @@ class GenerateView(View):
redirect=redirect)
response = http.HttpResponse(content_type='application/binary')
response['Content-Disposition'] = \
'attachment; filename=%s.pem' % slugify(keypair.name)
response['Content-Disposition'] = ('attachment; filename=%s.pem'
% slugify(keypair.name))
response.write(keypair.private_key)
response['Content-Length'] = str(len(response.content))
return response

View File

@ -52,7 +52,7 @@ class CreateGroup(forms.SelfHandlingForm):
data['description'])
messages.success(request,
_('Successfully created security group: %s')
% data['name'])
% data['name'])
return sg
except Exception:
redirect = reverse("horizon:project:access_and_security:index")
@ -82,7 +82,7 @@ class UpdateGroup(forms.SelfHandlingForm):
data['description'])
messages.success(request,
_('Successfully updated security group: %s')
% data['name'])
% data['name'])
return sg
except Exception:
redirect = reverse("horizon:project:access_and_security:index")
@ -206,16 +206,16 @@ class AddRule(forms.SelfHandlingForm):
'data-slug': 'remote'}))
cidr = forms.IPField(label=_("CIDR"),
required=False,
initial="0.0.0.0/0",
help_text=_("Classless Inter-Domain Routing "
"(e.g. 192.168.0.0/24)"),
version=forms.IPv4 | forms.IPv6,
mask=True,
widget=forms.TextInput(
attrs={'class': 'switched',
'data-switch-on': 'remote',
'data-remote-cidr': _('CIDR')}))
required=False,
initial="0.0.0.0/0",
help_text=_("Classless Inter-Domain Routing "
"(e.g. 192.168.0.0/24)"),
version=forms.IPv4 | forms.IPv6,
mask=True,
widget=forms.TextInput(
attrs={'class': 'switched',
'data-switch-on': 'remote',
'data-remote-cidr': _('CIDR')}))
security_group = forms.ChoiceField(label=_('Security Group'),
required=False,

View File

@ -81,7 +81,7 @@ class SecurityGroupsViewTests(test.TestCase):
def test_update_security_groups_get(self):
sec_group = self.security_groups.first()
api.network.security_group_get(IsA(http.HttpRequest),
sec_group.id).AndReturn(sec_group)
sec_group.id).AndReturn(sec_group)
self.mox.ReplayAll()
res = self.client.get(reverse('horizon:project:access_and_security:'
@ -97,12 +97,12 @@ class SecurityGroupsViewTests(test.TestCase):
def test_update_security_groups_post(self):
sec_group = self.security_groups.get(name="other_group")
api.network.security_group_update(IsA(http.HttpRequest),
str(sec_group.id),
sec_group.name,
sec_group.description) \
str(sec_group.id),
sec_group.name,
sec_group.description) \
.AndReturn(sec_group)
api.network.security_group_get(IsA(http.HttpRequest),
sec_group.id).AndReturn(sec_group)
sec_group.id).AndReturn(sec_group)
self.mox.ReplayAll()
formData = {'method': 'UpdateGroup',
@ -182,8 +182,8 @@ class SecurityGroupsViewTests(test.TestCase):
sec_group = self.security_groups.first()
api.network.security_group_get(IsA(http.HttpRequest),
sec_group.id) \
.AndRaise(self.exceptions.nova)
sec_group.id) \
.AndRaise(self.exceptions.nova)
self.mox.ReplayAll()

View File

@ -206,8 +206,8 @@ class SecurityGroupTabTests(test.TestCase):
create_link = tables.CreateGroup()
url = create_link.get_link_url()
classes = list(create_link.get_default_classes())\
+ list(create_link.classes)
classes = (list(create_link.get_default_classes())
+ list(create_link.classes))
link_name = "%s (%s)" % (unicode(create_link.verbose_name),
"Quota exceeded")
expected_string = "<a href='%s' title='%s' class='%s disabled' "\

View File

@ -34,7 +34,7 @@ urlpatterns = patterns(VIEW_MOD,
name='create'),
url(r'^(?P<container_name>.+?)/(?P<subfolder_path>(.+/)+)'
'?container_detail$',
'?container_detail$',
views.ContainerDetailView.as_view(),
name='container_detail'),
@ -52,13 +52,13 @@ urlpatterns = patterns(VIEW_MOD,
name='object_upload'),
url(r'^(?P<container_name>.+?)/(?P<subfolder_path>(.+/)+)'
'?create_pseudo_folder',
'?create_pseudo_folder',
views.CreatePseudoFolderView.as_view(),
name='create_pseudo_folder'),
url(r'^(?P<container_name>[^/]+)/'
r'(?P<subfolder_path>(.+/)+)?'
r'(?P<object_name>.+)/copy$',
r'(?P<subfolder_path>(.+/)+)?'
r'(?P<object_name>.+)/copy$',
views.CopyView.as_view(),
name='object_copy'),

View File

@ -118,8 +118,8 @@ class GeneralConfigAction(workflows.Action):
hadoop_version)
return [(image.id, image.name) for image in all_images
if set(details.required_image_tags).
issubset(set(image.tags))]
if (set(details.required_image_tags).
issubset(set(image.tags)))]
except Exception:
exceptions.handle(request,
_("Unable to fetch image choices."))

View File

@ -93,8 +93,8 @@ class DetailView(horizon_views.APIView):
backup.parent = api.trove.backup_get(request, backup.parent_id)
except Exception:
redirect = reverse('horizon:project:database_backups:index')
msg = _('Unable to retrieve details for parent backup: %s') % \
backup.parent_id
msg = (_('Unable to retrieve details for parent backup: %s')
% backup.parent_id)
exceptions.handle(self.request, msg, redirect=redirect)
try:

View File

@ -121,7 +121,7 @@ class DatabaseTests(test.TestCase):
@test.create_stubs({
api.trove: ('flavor_list', 'backup_list',
'datastore_list', 'datastore_version_list')})
'datastore_list', 'datastore_version_list')})
def test_launch_instance(self):
api.trove.flavor_list(IsA(http.HttpRequest))\
.AndReturn(self.flavors.list())
@ -144,7 +144,7 @@ class DatabaseTests(test.TestCase):
self.mox.ReplayAll()
toSuppress = ["openstack_dashboard.dashboards.project.databases."
"workflows.create_instance",
"workflows.create_instance",
"horizon.workflows.base"]
# Suppress expected log messages in the test output

View File

@ -202,7 +202,7 @@ class UpdateFirewallView(forms.ModalFormView):
firewall_id = self.kwargs['firewall_id']
try:
firewall = api.fwaas.firewall_get(self.request,
firewall_id)
firewall_id)
firewall.set_id_as_name_if_empty()
return firewall
except Exception:

View File

@ -165,7 +165,7 @@ class ImageViewTests(test.TestCase):
'description': data['description'],
'architecture': data['architecture']},
name=data['name']). \
AndReturn(self.images.first())
AndReturn(self.images.first())
self.mox.ReplayAll()
url = reverse('horizon:project:images:images:create')
@ -205,7 +205,7 @@ class ImageViewTests(test.TestCase):
'architecture': data['architecture']},
name=data['name'],
data=IsA(InMemoryUploadedFile)). \
AndReturn(self.images.first())
AndReturn(self.images.first())
self.mox.ReplayAll()
url = reverse('horizon:project:images:images:create')
@ -219,7 +219,7 @@ class ImageViewTests(test.TestCase):
image = self.images.first()
api.glance.image_get(IsA(http.HttpRequest), str(image.id)) \
.AndReturn(self.images.first())
.AndReturn(self.images.first())
self.mox.ReplayAll()
res = self.client.get(reverse('horizon:project:images:images:detail',
@ -237,7 +237,7 @@ class ImageViewTests(test.TestCase):
image = self.images.list()[8]
api.glance.image_get(IsA(http.HttpRequest), str(image.id)) \
.AndReturn(image)
.AndReturn(image)
self.mox.ReplayAll()
res = self.client.get(reverse('horizon:project:images:images:detail',
@ -264,7 +264,7 @@ class ImageViewTests(test.TestCase):
image = self.images.list()[2]
api.glance.image_get(IsA(http.HttpRequest), str(image.id)) \
.AndReturn(image)
.AndReturn(image)
self.mox.ReplayAll()
res = self.client.get(
@ -279,7 +279,7 @@ class ImageViewTests(test.TestCase):
image = self.images.first()
api.glance.image_get(IsA(http.HttpRequest), str(image.id)) \
.AndRaise(self.exceptions.glance)
.AndRaise(self.exceptions.glance)
self.mox.ReplayAll()
url = reverse('horizon:project:images:images:detail',
@ -347,9 +347,10 @@ class OwnerFilterTests(test.TestCase):
if filter_string == 'public':
return filter(lambda im: im.is_public, images)
if filter_string == 'shared':
return filter(lambda im: not im.is_public and
im.owner != my_tenant_id and
im.owner not in special, images)
return filter(lambda im: (not im.is_public and
im.owner != my_tenant_id and
im.owner not in special),
images)
if filter_string == 'project':
filter_string = my_tenant_id
return filter(lambda im: im.owner == filter_string, images)

View File

@ -45,7 +45,7 @@ class SnapshotsViewTests(test.TestCase):
server = self.servers.first()
self.mox.StubOutWithMock(api.nova, 'server_get')
api.nova.server_get(IsA(http.HttpRequest), server.id) \
.AndRaise(self.exceptions.nova)
.AndRaise(self.exceptions.nova)
self.mox.ReplayAll()
url = reverse('horizon:project:images:snapshots:create',

View File

@ -129,11 +129,11 @@ class ImagesAndSnapshotsUtilsTests(test.TestCase):
api.glance.image_list_detailed(IsA(http.HttpRequest),
filters={'is_public': True,
'status': 'active'}) \
.AndReturn([public_images, False, False])
.AndReturn([public_images, False, False])
api.glance.image_list_detailed(IsA(http.HttpRequest),
filters={'property-owner_id': self.tenant.id,
'status': 'active'}) \
.AndReturn([private_images, False, False])
.AndReturn([private_images, False, False])
self.mox.ReplayAll()
@ -154,15 +154,15 @@ class ImagesAndSnapshotsUtilsTests(test.TestCase):
api.glance.image_list_detailed(IsA(http.HttpRequest),
filters={'is_public': True,
'status': 'active'}) \
.AndReturn([public_images, False, False])
.AndReturn([public_images, False, False])
api.glance.image_list_detailed(IsA(http.HttpRequest),
filters={'property-owner_id': self.tenant.id,
'status': 'active'}) \
.AndReturn([private_images, False, False])
.AndReturn([private_images, False, False])
api.glance.image_list_detailed(IsA(http.HttpRequest),
filters={'property-owner_id': 'other-tenant',
'status': 'active'}) \
.AndReturn([private_images, False, False])
.AndReturn([private_images, False, False])
self.mox.ReplayAll()
@ -209,17 +209,17 @@ class ImagesAndSnapshotsUtilsTests(test.TestCase):
api.glance.image_list_detailed(IsA(http.HttpRequest),
filters={'is_public': True,
'status': 'active'}) \
.AndRaise(self.exceptions.glance)
.AndRaise(self.exceptions.glance)
exceptions.handle(IsA(http.HttpRequest),
"Unable to retrieve public images.")
api.glance.image_list_detailed(IsA(http.HttpRequest),
filters={'property-owner_id': self.tenant.id,
'status': 'active'}) \
.AndReturn([private_images, False, False])
.AndReturn([private_images, False, False])
api.glance.image_list_detailed(IsA(http.HttpRequest),
filters={'is_public': True,
'status': 'active'}) \
.AndReturn([public_images, False, False])
.AndReturn([public_images, False, False])
self.mox.ReplayAll()
@ -261,17 +261,17 @@ class ImagesAndSnapshotsUtilsTests(test.TestCase):
api.glance.image_list_detailed(IsA(http.HttpRequest),
filters={'is_public': True,
'status': 'active'}) \
.AndReturn([public_images, False, False])
.AndReturn([public_images, False, False])
api.glance.image_list_detailed(IsA(http.HttpRequest),
filters={'property-owner_id': self.tenant.id,
'status': 'active'}) \
.AndRaise(self.exceptions.glance)
.AndRaise(self.exceptions.glance)
exceptions.handle(IsA(http.HttpRequest),
"Unable to retrieve images for the current project.")
api.glance.image_list_detailed(IsA(http.HttpRequest),
filters={'property-owner_id': self.tenant.id,
'status': 'active'}) \
.AndReturn([private_images, False, False])
.AndReturn([private_images, False, False])
self.mox.ReplayAll()

View File

@ -37,8 +37,8 @@ class RebuildInstanceForm(forms.SelfHandlingForm):
image = forms.ChoiceField(label=_("Select Image"),
widget=forms.SelectWidget(attrs={'class': 'image-selector'},
data_attrs=('size', 'display-name'),
transform=_image_choice_title))
data_attrs=('size', 'display-name'),
transform=_image_choice_title))
password = forms.RegexField(label=_("Rebuild Password"),
required=False,
widget=forms.PasswordInput(render_value=False),

File diff suppressed because it is too large Load Diff

View File

@ -278,7 +278,7 @@ class DetailView(tabs.TabView):
exceptions.handle(self.request,
_('Unable to retrieve details for '
'instance "%s".') % instance_id,
redirect=redirect)
redirect=redirect)
# Not all exception types handled above will result in a redirect.
# Need to raise here just in case.
raise exceptions.Http302(redirect)

View File

@ -98,7 +98,7 @@ class SetInstanceDetailsAction(workflows.Action):
volume_id = forms.ChoiceField(label=_("Volume"), required=False)
volume_snapshot_id = forms.ChoiceField(label=_("Volume Snapshot"),
required=False)
required=False)
image_id = forms.ChoiceField(
label=_("Image Name"),
@ -320,7 +320,7 @@ class SetInstanceDetailsAction(workflows.Action):
_('Unable to retrieve availability zones.'))
zone_list = [(zone.zoneName, zone.zoneName)
for zone in zones if zone.zoneState['available']]
for zone in zones if zone.zoneState['available']]
zone_list.sort()
if not zone_list:
zone_list.insert(0, ("", _("No availability zones found")))
@ -343,7 +343,7 @@ class SetInstanceDetailsAction(workflows.Action):
attrs = [{'id': i.id,
'min_disk': getattr(i, 'min_disk', 0),
'min_ram': getattr(i, 'min_ram', 0)}
for i in images]
for i in images]
extra['images'] = json.dumps(attrs)
except Exception:
@ -406,8 +406,8 @@ class SetInstanceDetailsAction(workflows.Action):
try:
volumes = [self._get_volume_display_name(v)
for v in cinder.volume_list(self.request)
if v.status == api.cinder.VOLUME_STATE_AVAILABLE
and v.bootable == 'true']
if (v.status == api.cinder.VOLUME_STATE_AVAILABLE
and v.bootable == 'true')]
except Exception:
volumes = []
exceptions.handle(self.request,
@ -567,8 +567,8 @@ class CustomizeAction(workflows.Action):
attributes = {'class': 'switchable', 'data-slug': 'scriptsource'}
script_source = forms.ChoiceField(label=_('Customization Script Source'),
choices=source_choices,
widget=forms.Select(attrs=attributes))
choices=source_choices,
widget=forms.Select(attrs=attributes))
script_help = _("A script or set of commands to be executed after the "
"instance has been built (max 16kb).")

View File

@ -30,8 +30,8 @@ LOG = logging.getLogger(__name__)
class UpdatePool(forms.SelfHandlingForm):
name = forms.CharField(max_length=80, label=_("Name"))
pool_id = forms.CharField(label=_("ID"),
widget=forms.TextInput(
attrs={'readonly': 'readonly'}))
widget=forms.TextInput(
attrs={'readonly': 'readonly'}))
description = forms.CharField(required=False,
max_length=80, label=_("Description"))
lb_method = forms.ChoiceField(label=_("Load Balancing Method"))
@ -72,8 +72,8 @@ class UpdatePool(forms.SelfHandlingForm):
class UpdateVip(forms.SelfHandlingForm):
name = forms.CharField(max_length=80, label=_("Name"))
vip_id = forms.CharField(label=_("ID"),
widget=forms.TextInput(
attrs={'readonly': 'readonly'}))
widget=forms.TextInput(
attrs={'readonly': 'readonly'}))
description = forms.CharField(required=False,
max_length=80, label=_("Description"))
pool_id = forms.ChoiceField(label=_("Pool"))
@ -167,8 +167,8 @@ class UpdateVip(forms.SelfHandlingForm):
class UpdateMember(forms.SelfHandlingForm):
member_id = forms.CharField(label=_("ID"),
widget=forms.TextInput(
attrs={'readonly': 'readonly'}))
widget=forms.TextInput(
attrs={'readonly': 'readonly'}))
pool_id = forms.ChoiceField(label=_("Pool"))
weight = forms.IntegerField(max_value=256, min_value=0, label=_("Weight"),
help_text=_("Relative part of requests this "

View File

@ -77,7 +77,7 @@ class IndexView(tabs.TabView):
except Exception as e:
exceptions.handle(request,
_('Unable to locate VIP to delete. %s')
% e)
% e)
if vip_id is not None:
try:
api.lbaas.vip_delete(request, vip_id)

View File

@ -79,14 +79,14 @@ class CreateSubnet(network_workflows.CreateNetwork):
class UpdateSubnetInfoAction(CreateSubnetInfoAction):
cidr = forms.IPField(label=_("Network Address"),
required=False,
initial="",
widget=forms.TextInput(
attrs={'readonly': 'readonly'}),
help_text=_("Network address in CIDR format "
"(e.g. 192.168.0.0/24)"),
version=forms.IPv4 | forms.IPv6,
mask=True)
required=False,
initial="",
widget=forms.TextInput(
attrs={'readonly': 'readonly'}),
help_text=_("Network address in CIDR format "
"(e.g. 192.168.0.0/24)"),
version=forms.IPv4 | forms.IPv6,
mask=True)
# NOTE(amotoki): When 'disabled' attribute is set for the ChoiceField
# and ValidationError is raised for POST request, the initial value of
# the ip_version ChoiceField is not set in the re-displayed form

View File

@ -1790,8 +1790,8 @@ class NetworkViewTests(test.TestCase):
create_link = tables.CreateNetwork()
url = create_link.get_link_url()
classes = list(create_link.get_default_classes())\
+ list(create_link.classes)
classes = (list(create_link.get_default_classes())
+ list(create_link.classes))
link_name = "%s (%s)" % (unicode(create_link.verbose_name),
"Quota exceeded")
expected_string = "<a href='%s' title='%s' class='%s disabled' "\

View File

@ -106,17 +106,17 @@ class CreateSubnetInfoAction(workflows.Action):
label=_("Subnet Name"),
required=False)
cidr = forms.IPField(label=_("Network Address"),
required=False,
initial="",
widget=forms.TextInput(attrs={
'class': 'switched',
'data-switch-on': 'with_subnet',
'data-is-required': 'true'
}),
help_text=_("Network address in CIDR format "
"(e.g. 192.168.0.0/24, 2001:DB8::/48)"),
version=forms.IPv4 | forms.IPv6,
mask=True)
required=False,
initial="",
widget=forms.TextInput(attrs={
'class': 'switched',
'data-switch-on': 'with_subnet',
'data-is-required': 'true'
}),
help_text=_("Network address in CIDR format "
"(e.g. 192.168.0.0/24, 2001:DB8::/48)"),
version=forms.IPv4 | forms.IPv6,
mask=True)
ip_version = forms.ChoiceField(choices=[(4, 'IPv4'), (6, 'IPv6')],
widget=forms.Select(attrs={
'class': 'switchable switched',

View File

@ -45,7 +45,7 @@ class UsageViewTests(test.TestCase):
def _stub_cinder_api_calls(self):
self.mox.StubOutWithMock(api.cinder, 'tenant_absolute_limits')
api.cinder.tenant_absolute_limits(IsA(http.HttpRequest)) \
.AndReturn(self.cinder_limits['absolute'])
.AndReturn(self.cinder_limits['absolute'])
def _stub_neutron_api_calls(self, neutron_sg_enabled=True):
self.mox.StubOutWithMock(api.neutron, 'is_extension_supported')
@ -59,7 +59,7 @@ class UsageViewTests(test.TestCase):
api.network.floating_ip_supported(IsA(http.HttpRequest)) \
.AndReturn(True)
api.network.tenant_floating_ip_list(IsA(http.HttpRequest)) \
.AndReturn(self.floating_ips.list())
.AndReturn(self.floating_ips.list())
if neutron_sg_enabled:
api.network.security_group_list(IsA(http.HttpRequest)) \
.AndReturn(self.q_secgroups.list())
@ -86,10 +86,10 @@ class UsageViewTests(test.TestCase):
datetime.datetime(now.year,
now.month,
now.day, 23, 59, 59, 0)) \
.AndReturn(usage_obj)
.AndReturn(usage_obj)
api.nova.tenant_absolute_limits(IsA(http.HttpRequest)) \
.AndReturn(self.limits['absolute'])
.AndReturn(self.limits['absolute'])
self._stub_neutron_api_calls()
self._stub_cinder_api_calls()
self.mox.ReplayAll()
@ -124,17 +124,17 @@ class UsageViewTests(test.TestCase):
api.nova.usage_get(IsA(http.HttpRequest), self.tenant.id,
datetime.datetime(now.year,
now.month,
1, 0, 0, 0, 0),
1, 0, 0, 0, 0),
datetime.datetime(now.year,
now.month,
now.day, 23, 59, 59, 0)) \
.AndReturn(usage_obj)
api.nova.tenant_absolute_limits(IsA(http.HttpRequest)) \
.AndReturn(self.limits['absolute'])
.AndReturn(self.limits['absolute'])
api.base.is_service_enabled(IsA(http.HttpRequest), 'network') \
.MultipleTimes().AndReturn(False)
.MultipleTimes().AndReturn(False)
api.base.is_service_enabled(IsA(http.HttpRequest), 'volume') \
.MultipleTimes().AndReturn(False)
.MultipleTimes().AndReturn(False)
self.mox.ReplayAll()
@ -164,9 +164,9 @@ class UsageViewTests(test.TestCase):
datetime.datetime(now.year,
now.month,
now.day, 23, 59, 59, 0)) \
.AndRaise(exc)
.AndRaise(exc)
api.nova.tenant_absolute_limits(IsA(http.HttpRequest))\
.AndReturn(self.limits['absolute'])
.AndReturn(self.limits['absolute'])
self._stub_neutron_api_calls()
self._stub_cinder_api_calls()
self.mox.ReplayAll()
@ -241,7 +241,7 @@ class UsageViewTests(test.TestCase):
self.tenant.id,
start, end).AndReturn(usage_obj)
api.nova.tenant_absolute_limits(IsA(http.HttpRequest))\
.AndRaise(self.exceptions.nova)
.AndRaise(self.exceptions.nova)
self._stub_neutron_api_calls()
self._stub_cinder_api_calls()
self.mox.ReplayAll()
@ -322,7 +322,7 @@ class UsageViewTests(test.TestCase):
api.network.security_group_list(IsA(http.HttpRequest)) \
.AndReturn(self.q_secgroups.list())
api.neutron.tenant_quota_get(IsA(http.HttpRequest), self.tenant.id) \
.AndReturn(self.neutron_quotas.first())
.AndReturn(self.neutron_quotas.first())
self.mox.ReplayAll()
self._test_usage_with_neutron_check(neutron_sg_enabled)
@ -385,15 +385,15 @@ class UsageViewTests(test.TestCase):
self.tenant.id,
start, end).AndReturn(usage_obj)
api.nova.tenant_absolute_limits(IsA(http.HttpRequest)) \
.AndReturn(self.limits['absolute'])
.AndReturn(self.limits['absolute'])
if cinder_enabled:
self._stub_cinder_api_calls()
api.base.is_service_enabled(IsA(http.HttpRequest), 'network') \
.MultipleTimes().AndReturn(False)
.MultipleTimes().AndReturn(False)
api.base.is_service_enabled(IsA(http.HttpRequest), 'volume') \
.MultipleTimes().AndReturn(cinder_enabled)
.MultipleTimes().AndReturn(cinder_enabled)
self.mox.ReplayAll()
res = self.client.get(reverse('horizon:project:overview:index'))

View File

@ -158,9 +158,9 @@ class RulesGridTab(tabs.Tab):
dst = netaddr.IPNetwork(dst)
# check if cidrs are affected by rule first
if (int(dst.network) >= int(rd.broadcast) or
int(dst.broadcast) <= int(rd.network) or
int(src.network) >= int(rs.broadcast) or
int(src.broadcast) <= int(rs.network)):
int(dst.broadcast) <= int(rd.network) or
int(src.network) >= int(rs.broadcast) or
int(src.broadcast) <= int(rs.network)):
continue
# skip matching rules for 'any' and 'external' networks
@ -194,7 +194,7 @@ class RulesGridTab(tabs.Tab):
reverse=True)
match = sortedrules[0]
if (match['bitsinsrc'] > src.prefixlen or
match['bitsindst'] > dst.prefixlen):
match['bitsindst'] > dst.prefixlen):
connectivity['reachable'] = 'partial'
connectivity['conflicting_rule'] = match['rule']
return connectivity

View File

@ -777,8 +777,8 @@ class RouterViewTests(test.TestCase):
create_link = tables.CreateRouter()
url = create_link.get_link_url()
classes = list(create_link.get_default_classes())\
+ list(create_link.classes)
classes = (list(create_link.get_default_classes())
+ list(create_link.classes))
link_name = "%s (%s)" % (unicode(create_link.verbose_name),
"Quota exceeded")
expected_string = "<a href='%s' title='%s' class='%s disabled' "\

View File

@ -107,29 +107,25 @@ class StackTests(test.TestCase):
stacks = self.stacks.list()[:5]
api.heat.stacks_list(IsA(http.HttpRequest),
marker=None,
paginate=True,
sort_dir='desc') \
.AndReturn([stacks,
True, True])
marker=None,
paginate=True,
sort_dir='desc') \
.AndReturn([stacks, True, True])
api.heat.stacks_list(IsA(http.HttpRequest),
marker=None,
paginate=True,
sort_dir='desc') \
.AndReturn([stacks[:2],
True, True])
marker=None,
paginate=True,
sort_dir='desc') \
.AndReturn([stacks[:2], True, True])
api.heat.stacks_list(IsA(http.HttpRequest),
marker=stacks[2].id,
paginate=True,
sort_dir='desc') \
.AndReturn([stacks[2:4],
True, True])
marker=stacks[2].id,
paginate=True,
sort_dir='desc') \
.AndReturn([stacks[2:4], True, True])
api.heat.stacks_list(IsA(http.HttpRequest),
marker=stacks[4].id,
paginate=True,
sort_dir='desc') \
.AndReturn([stacks[4:],
True, True])
marker=stacks[4].id,
paginate=True,
sort_dir='desc') \
.AndReturn([stacks[4:], True, True])
self.mox.ReplayAll()
url = reverse('horizon:project:stacks:index')
@ -164,29 +160,25 @@ class StackTests(test.TestCase):
stacks = self.stacks.list()[:3]
api.heat.stacks_list(IsA(http.HttpRequest),
marker=None,
paginate=True,
sort_dir='desc') \
.AndReturn([stacks,
True, False])
marker=None,
paginate=True,
sort_dir='desc') \
.AndReturn([stacks, True, False])
api.heat.stacks_list(IsA(http.HttpRequest),
marker=None,
paginate=True,
sort_dir='desc') \
.AndReturn([stacks[:2],
True, True])
marker=None,
paginate=True,
sort_dir='desc') \
.AndReturn([stacks[:2], True, True])
api.heat.stacks_list(IsA(http.HttpRequest),
marker=stacks[2].id,
paginate=True,
sort_dir='desc') \
.AndReturn([stacks[2:],
True, True])
marker=stacks[2].id,
paginate=True,
sort_dir='desc') \
.AndReturn([stacks[2:], True, True])
api.heat.stacks_list(IsA(http.HttpRequest),
marker=stacks[2].id,
paginate=True,
sort_dir='asc') \
.AndReturn([stacks[:2],
True, True])
marker=stacks[2].id,
paginate=True,
sort_dir='asc') \
.AndReturn([stacks[:2], True, True])
self.mox.ReplayAll()
url = reverse('horizon:project:stacks:index')
@ -362,14 +354,16 @@ class StackTests(test.TestCase):
self.assertTemplateUsed(res, 'project/stacks/create.html')
# ensure the fields were rendered correctly
self.assertContains(res, '<input class="form-control" '
'id="id___param_public_string" '
'name="__param_public_string" '
'type="text" />', html=True)
self.assertContains(res, '<input class="form-control" '
'id="id___param_secret_string" '
'name="__param_secret_string" '
'type="password" />', html=True)
self.assertContains(res,
'<input class="form-control" '
'id="id___param_public_string" '
'name="__param_public_string" '
'type="text" />', html=True)
self.assertContains(res,
'<input class="form-control" '
'id="id___param_secret_string" '
'name="__param_secret_string" '
'type="password" />', html=True)
@test.create_stubs({api.heat: ('template_validate',)})
def test_launch_stack_with_parameter_group(self):
@ -568,14 +562,14 @@ class StackTests(test.TestCase):
self.assertRedirectsNoFollow(res, INDEX_URL)
@test.create_stubs({api.heat: ('stack_update', 'stack_get',
'template_get', 'template_validate')})
'template_get', 'template_validate')})
def test_edit_stack_template(self):
template = self.stack_templates.first()
stack = self.stacks.first()
# GET to template form
api.heat.stack_get(IsA(http.HttpRequest),
stack.id).AndReturn(stack)
stack.id).AndReturn(stack)
# POST template form, validation
api.heat.template_validate(IsA(http.HttpRequest),
template=template.data) \
@ -583,7 +577,7 @@ class StackTests(test.TestCase):
# GET to edit form
api.heat.stack_get(IsA(http.HttpRequest),
stack.id).AndReturn(stack)
stack.id).AndReturn(stack)
api.heat.template_get(IsA(http.HttpRequest),
stack.id) \
.AndReturn(json.loads(template.validate))

View File

@ -85,7 +85,7 @@ class UpdateRow(tables.Row):
backup = cinder.volume_backup_get(request, backup_id)
try:
backup.volume = cinder.volume_get(request,
backup.volume_id)
backup.volume_id)
except Exception:
pass
return backup

View File

@ -35,7 +35,7 @@ class VolumeBackupsViewTests(test.TestCase):
backup.container_name,
backup.name,
backup.description) \
.AndReturn(backup)
.AndReturn(backup)
self.mox.ReplayAll()
formData = {'method': 'CreateBackupForm',

View File

@ -135,18 +135,18 @@ class CreateForm(forms.SelfHandlingForm):
self.fields['name'].initial = image.name
min_vol_size = functions.bytes_to_gigabytes(
image.size)
size_help_text = _('Volume size must be equal to or greater '
'than the image size (%s)') \
% filesizeformat(image.size)
size_help_text = (_('Volume size must be equal to or greater '
'than the image size (%s)')
% filesizeformat(image.size))
properties = getattr(image, 'properties', {})
min_disk_size = getattr(image, 'min_disk', 0) or \
properties.get('min_disk', 0)
min_disk_size = (getattr(image, 'min_disk', 0) or
properties.get('min_disk', 0))
if (min_disk_size > min_vol_size):
min_vol_size = min_disk_size
size_help_text = _('Volume size must be equal to or '
'greater than the image minimum '
'disk size (%sGB)') \
% min_disk_size
size_help_text = (_('Volume size must be equal to or '
'greater than the image minimum '
'disk size (%sGB)')
% min_disk_size)
self.fields['size'].initial = min_vol_size
self.fields['size'].help_text = size_help_text
self.fields['image_source'].choices = ((image.id, image),)
@ -170,9 +170,9 @@ class CreateForm(forms.SelfHandlingForm):
self.fields['name'].initial = volume.name
self.fields['description'].initial = volume.description
min_vol_size = volume.size
size_help_text = _('Volume size must be equal to or greater '
'than the origin volume size (%s)') \
% filesizeformat(volume.size)
size_help_text = (_('Volume size must be equal to or greater '
'than the origin volume size (%s)')
% filesizeformat(volume.size))
self.fields['size'].initial = min_vol_size
self.fields['size'].help_text = size_help_text
self.fields['volume_source'].choices = ((volume.id, volume),)
@ -188,7 +188,7 @@ class CreateForm(forms.SelfHandlingForm):
try:
snapshot_list = cinder.volume_snapshot_list(request)
snapshots = [s for s in snapshot_list
if s.status == 'available']
if s.status == 'available']
if snapshots:
source_type_choices.append(("snapshot_source",
_("Snapshot")))
@ -227,7 +227,7 @@ class CreateForm(forms.SelfHandlingForm):
if source_type_choices:
choices = ([('no_source_type',
_("No source, empty volume"))] +
source_type_choices)
source_type_choices)
self.fields['volume_source_type'].choices = choices
else:
del self.fields['volume_source_type']
@ -265,7 +265,7 @@ class CreateForm(forms.SelfHandlingForm):
try:
zones = api.cinder.availability_zone_list(request)
zone_list = [(zone.zoneName, zone.zoneName)
for zone in zones if zone.zoneState['available']]
for zone in zones if zone.zoneState['available']]
zone_list.sort()
except Exception:
exceptions.handle(request, _('Unable to retrieve availability '
@ -302,7 +302,7 @@ class CreateForm(forms.SelfHandlingForm):
source_type = data.get('volume_source_type', None)
az = data.get('availability_zone', None) or None
if (data.get("snapshot_source", None) and
source_type in [None, 'snapshot_source']):
source_type in [None, 'snapshot_source']):
# Create from Snapshot
snapshot = self.get_snapshot(request,
data["snapshot_source"])
@ -324,8 +324,8 @@ class CreateForm(forms.SelfHandlingForm):
'the image size (%s)') % filesizeformat(image.size)
raise ValidationError(error_message)
properties = getattr(image, 'properties', {})
min_disk_size = getattr(image, 'min_disk', 0) or \
properties.get('min_disk', 0)
min_disk_size = (getattr(image, 'min_disk', 0) or
properties.get('min_disk', 0))
if (min_disk_size > 0 and data['size'] < min_disk_size):
error_message = _('The volume size cannot be less than '
'the image minimum disk size (%sGB)') % min_disk_size
@ -456,9 +456,9 @@ class AttachForm(forms.SelfHandlingForm):
data.get('device', ''))
volume = cinder.volume_get(request, data['volume_id'])
message = _('Attaching volume %(vol)s to instance '
'%(inst)s on %(dev)s.') % {"vol": volume.name,
"inst": instance_name,
"dev": attach.device}
'%(inst)s on %(dev)s.') % {"vol": volume.name,
"inst": instance_name,
"dev": attach.device}
messages.info(request, message)
return True
except Exception:
@ -550,8 +550,8 @@ class UploadToImageForm(forms.SelfHandlingForm):
# I can only use 'raw', 'vmdk', 'vdi' or 'qcow2' so qemu-img will not
# have issues when processes image request from cinder.
disk_format_choices = [(value, name) for value, name
in IMAGE_FORMAT_CHOICES
if value in VALID_DISK_FORMATS]
in IMAGE_FORMAT_CHOICES
if value in VALID_DISK_FORMATS]
self.fields['disk_format'].choices = disk_format_choices
self.fields['disk_format'].initial = 'raw'
if self.initial['status'] != 'in-use':
@ -654,7 +654,7 @@ class RetypeForm(forms.SelfHandlingForm):
try:
volume_types = cinder.volume_type_list(request)
self.fields['volume_type'].choices = [(t.name, t.name)
for t in volume_types]
for t in volume_types]
self.fields['volume_type'].initial = self.initial['volume_type']
except Exception:

View File

@ -189,7 +189,7 @@ class CreateSnapshot(VolumePolicyTargetMixin, tables.LinkAction):
if snapshots_available <= 0 and "disabled" not in self.classes:
self.classes = [c for c in self.classes] + ['disabled']
self.verbose_name = string_concat(self.verbose_name, ' ',
_("(Quota exceeded)"))
_("(Quota exceeded)"))
return volume.status in ("available", "in-use")
@ -217,8 +217,8 @@ class UploadToImage(VolumePolicyTargetMixin, tables.LinkAction):
has_image_service_perm = \
request.user.has_perm('openstack.services.image')
return volume.status in ("available", "in-use") and \
has_image_service_perm
return (volume.status in ("available", "in-use") and
has_image_service_perm)
class EditVolume(VolumePolicyTargetMixin, tables.LinkAction):

View File

@ -62,19 +62,19 @@ class VolumeViewTests(test.TestCase):
'availability_zone': az}
cinder.volume_type_list(IsA(http.HttpRequest)).\
AndReturn(self.volume_types.list())
AndReturn(self.volume_types.list())
quotas.tenant_limit_usages(IsA(http.HttpRequest)).\
AndReturn(usage_limit)
AndReturn(usage_limit)
cinder.volume_snapshot_list(IsA(http.HttpRequest)).\
AndReturn(self.cinder_volume_snapshots.list())
api.glance.image_list_detailed(IsA(http.HttpRequest),
filters={'is_public': True,
'status': 'active'}) \
.AndReturn([self.images.list(), False, False])
.AndReturn([self.images.list(), False, False])
api.glance.image_list_detailed(IsA(http.HttpRequest),
filters={'property-owner_id': self.tenant.id,
'status': 'active'}) \
.AndReturn([[], False, False])
.AndReturn([[], False, False])
cinder.availability_zone_list(IsA(http.HttpRequest)).AndReturn(
self.cinder_availability_zones.list())
@ -127,21 +127,21 @@ class VolumeViewTests(test.TestCase):
'image_source': self.images.first().id}
cinder.volume_type_list(IsA(http.HttpRequest)).\
AndReturn(self.volume_types.list())
AndReturn(self.volume_types.list())
cinder.volume_snapshot_list(IsA(http.HttpRequest)).\
AndReturn(self.cinder_volume_snapshots.list())
AndReturn(self.cinder_volume_snapshots.list())
api.glance.image_list_detailed(IsA(http.HttpRequest),
filters={'is_public': True,
'status': 'active'}) \
.AndReturn([self.images.list(), False, False])
.AndReturn([self.images.list(), False, False])
api.glance.image_list_detailed(IsA(http.HttpRequest),
filters={'property-owner_id': self.tenant.id,
'status': 'active'}) \
.AndReturn([[], False, False])
.AndReturn([[], False, False])
cinder.volume_list(IsA(
http.HttpRequest)).AndReturn(self.cinder_volumes.list())
quotas.tenant_limit_usages(IsA(http.HttpRequest)).\
AndReturn(usage_limit)
AndReturn(usage_limit)
cinder.extension_supported(IsA(http.HttpRequest), 'AvailabilityZones')\
.AndReturn(True)
@ -187,13 +187,13 @@ class VolumeViewTests(test.TestCase):
'snapshot_source': snapshot.id}
cinder.volume_type_list(IsA(http.HttpRequest)).\
AndReturn(self.volume_types.list())
AndReturn(self.volume_types.list())
quotas.tenant_limit_usages(IsA(http.HttpRequest)).\
AndReturn(usage_limit)
AndReturn(usage_limit)
cinder.volume_snapshot_get(IsA(http.HttpRequest),
str(snapshot.id)).AndReturn(snapshot)
cinder.volume_get(IsA(http.HttpRequest), snapshot.volume_id).\
AndReturn(self.cinder_volumes.first())
AndReturn(self.cinder_volumes.first())
cinder.volume_create(IsA(http.HttpRequest),
formData['size'],
@ -242,13 +242,13 @@ class VolumeViewTests(test.TestCase):
'volume_source': volume.id}
cinder.volume_list(IsA(http.HttpRequest)).\
AndReturn(self.cinder_volumes.list())
AndReturn(self.cinder_volumes.list())
cinder.volume_type_list(IsA(http.HttpRequest)).\
AndReturn(self.volume_types.list())
AndReturn(self.volume_types.list())
cinder.volume_snapshot_list(IsA(http.HttpRequest)).\
AndReturn(self.cinder_volume_snapshots.list())
AndReturn(self.cinder_volume_snapshots.list())
quotas.tenant_limit_usages(IsA(http.HttpRequest)).\
AndReturn(usage_limit)
AndReturn(usage_limit)
cinder.volume_get(IsA(http.HttpRequest),
volume.id).AndReturn(self.cinder_volumes.first())
@ -259,11 +259,11 @@ class VolumeViewTests(test.TestCase):
api.glance.image_list_detailed(IsA(http.HttpRequest),
filters={'is_public': True,
'status': 'active'}) \
.AndReturn([self.images.list(), False, False])
.AndReturn([self.images.list(), False, False])
api.glance.image_list_detailed(IsA(http.HttpRequest),
filters={'property-owner_id': self.tenant.id,
'status': 'active'}) \
.AndReturn([[], False, False])
.AndReturn([[], False, False])
cinder.volume_create(IsA(http.HttpRequest),
formData['size'],
@ -310,21 +310,21 @@ class VolumeViewTests(test.TestCase):
'snapshot_source': snapshot.id}
cinder.volume_type_list(IsA(http.HttpRequest)).\
AndReturn(self.volume_types.list())
AndReturn(self.volume_types.list())
cinder.volume_snapshot_list(IsA(http.HttpRequest)).\
AndReturn(self.cinder_volume_snapshots.list())
AndReturn(self.cinder_volume_snapshots.list())
api.glance.image_list_detailed(IsA(http.HttpRequest),
filters={'is_public': True,
'status': 'active'}) \
.AndReturn([self.images.list(), False, False])
.AndReturn([self.images.list(), False, False])
api.glance.image_list_detailed(IsA(http.HttpRequest),
filters={'property-owner_id': self.tenant.id,
'status': 'active'}) \
.AndReturn([[], False, False])
.AndReturn([[], False, False])
cinder.volume_list(IsA(
http.HttpRequest)).AndReturn(self.cinder_volumes.list())
quotas.tenant_limit_usages(IsA(http.HttpRequest)).\
AndReturn(usage_limit)
AndReturn(usage_limit)
cinder.volume_snapshot_get(IsA(http.HttpRequest),
str(snapshot.id)).AndReturn(snapshot)
@ -370,16 +370,16 @@ class VolumeViewTests(test.TestCase):
'size': 20, 'snapshot_source': snapshot.id}
cinder.volume_type_list(IsA(http.HttpRequest)).\
AndReturn(self.volume_types.list())
AndReturn(self.volume_types.list())
quotas.tenant_limit_usages(IsA(http.HttpRequest)).\
AndReturn(usage_limit)
AndReturn(usage_limit)
cinder.volume_snapshot_get(IsA(http.HttpRequest),
str(snapshot.id)).AndReturn(snapshot)
cinder.volume_get(IsA(http.HttpRequest), snapshot.volume_id).\
AndReturn(self.cinder_volumes.first())
AndReturn(self.cinder_volumes.first())
quotas.tenant_limit_usages(IsA(http.HttpRequest)).\
AndReturn(usage_limit)
AndReturn(usage_limit)
self.mox.ReplayAll()
@ -413,9 +413,9 @@ class VolumeViewTests(test.TestCase):
'image_source': image.id}
cinder.volume_type_list(IsA(http.HttpRequest)).\
AndReturn(self.volume_types.list())
AndReturn(self.volume_types.list())
quotas.tenant_limit_usages(IsA(http.HttpRequest)).\
AndReturn(usage_limit)
AndReturn(usage_limit)
api.glance.image_get(IsA(http.HttpRequest),
str(image.id)).AndReturn(image)
@ -472,21 +472,21 @@ class VolumeViewTests(test.TestCase):
'image_source': image.id}
cinder.volume_type_list(IsA(http.HttpRequest)).\
AndReturn(self.volume_types.list())
AndReturn(self.volume_types.list())
cinder.volume_snapshot_list(IsA(http.HttpRequest)).\
AndReturn(self.cinder_volume_snapshots.list())
AndReturn(self.cinder_volume_snapshots.list())
api.glance.image_list_detailed(IsA(http.HttpRequest),
filters={'is_public': True,
'status': 'active'}) \
.AndReturn([self.images.list(), False, False])
.AndReturn([self.images.list(), False, False])
api.glance.image_list_detailed(IsA(http.HttpRequest),
filters={'property-owner_id': self.tenant.id,
'status': 'active'}) \
.AndReturn([[], False, False])
.AndReturn([[], False, False])
cinder.volume_list(IsA(
http.HttpRequest)).AndReturn(self.cinder_volumes.list())
quotas.tenant_limit_usages(IsA(http.HttpRequest)) \
.AndReturn(usage_limit)
.AndReturn(usage_limit)
api.glance.image_get(IsA(http.HttpRequest),
str(image.id)).AndReturn(image)
@ -533,9 +533,9 @@ class VolumeViewTests(test.TestCase):
'size': 1, 'image_source': image.id}
cinder.volume_type_list(IsA(http.HttpRequest)).\
AndReturn(self.volume_types.list())
AndReturn(self.volume_types.list())
quotas.tenant_limit_usages(IsA(http.HttpRequest)).\
AndReturn(usage_limit)
AndReturn(usage_limit)
api.glance.image_get(IsA(http.HttpRequest),
str(image.id)).AndReturn(image)
cinder.extension_supported(IsA(http.HttpRequest), 'AvailabilityZones')\
@ -543,7 +543,7 @@ class VolumeViewTests(test.TestCase):
cinder.availability_zone_list(IsA(http.HttpRequest)).AndReturn(
self.cinder_availability_zones.list())
quotas.tenant_limit_usages(IsA(http.HttpRequest)).\
AndReturn(usage_limit)
AndReturn(usage_limit)
self.mox.ReplayAll()
@ -581,9 +581,9 @@ class VolumeViewTests(test.TestCase):
'size': 5, 'image_source': image.id}
cinder.volume_type_list(IsA(http.HttpRequest)).\
AndReturn(self.volume_types.list())
AndReturn(self.volume_types.list())
quotas.tenant_limit_usages(IsA(http.HttpRequest)).\
AndReturn(usage_limit)
AndReturn(usage_limit)
api.glance.image_get(IsA(http.HttpRequest),
str(image.id)).AndReturn(image)
cinder.extension_supported(IsA(http.HttpRequest), 'AvailabilityZones')\
@ -591,7 +591,7 @@ class VolumeViewTests(test.TestCase):
cinder.availability_zone_list(IsA(http.HttpRequest)).AndReturn(
self.cinder_availability_zones.list())
quotas.tenant_limit_usages(IsA(http.HttpRequest)).\
AndReturn(usage_limit)
AndReturn(usage_limit)
self.mox.ReplayAll()
@ -633,19 +633,19 @@ class VolumeViewTests(test.TestCase):
'size': 5000}
cinder.volume_type_list(IsA(http.HttpRequest)).\
AndReturn(self.volume_types.list())
AndReturn(self.volume_types.list())
quotas.tenant_limit_usages(IsA(http.HttpRequest)).\
AndReturn(usage_limit)
AndReturn(usage_limit)
cinder.volume_snapshot_list(IsA(http.HttpRequest)).\
AndReturn(self.cinder_volume_snapshots.list())
api.glance.image_list_detailed(IsA(http.HttpRequest),
filters={'is_public': True,
'status': 'active'}) \
.AndReturn([self.images.list(), False, False])
.AndReturn([self.images.list(), False, False])
api.glance.image_list_detailed(IsA(http.HttpRequest),
filters={'property-owner_id': self.tenant.id,
'status': 'active'}) \
.AndReturn([[], False, False])
.AndReturn([[], False, False])
cinder.volume_list(IsA(
http.HttpRequest)).AndReturn(self.cinder_volumes.list())
cinder.extension_supported(IsA(http.HttpRequest), 'AvailabilityZones')\
@ -653,7 +653,7 @@ class VolumeViewTests(test.TestCase):
cinder.availability_zone_list(IsA(http.HttpRequest)).AndReturn(
self.cinder_availability_zones.list())
quotas.tenant_limit_usages(IsA(http.HttpRequest)).\
AndReturn(usage_limit)
AndReturn(usage_limit)
self.mox.ReplayAll()
@ -682,19 +682,19 @@ class VolumeViewTests(test.TestCase):
'size': 10}
cinder.volume_type_list(IsA(http.HttpRequest)).\
AndReturn(self.volume_types.list())
AndReturn(self.volume_types.list())
quotas.tenant_limit_usages(IsA(http.HttpRequest)).\
AndReturn(usage_limit)
AndReturn(usage_limit)
cinder.volume_snapshot_list(IsA(http.HttpRequest)).\
AndReturn(self.cinder_volume_snapshots.list())
api.glance.image_list_detailed(IsA(http.HttpRequest),
filters={'is_public': True,
'status': 'active'}) \
.AndReturn([self.images.list(), False, False])
.AndReturn([self.images.list(), False, False])
api.glance.image_list_detailed(IsA(http.HttpRequest),
filters={'property-owner_id': self.tenant.id,
'status': 'active'}) \
.AndReturn([[], False, False])
.AndReturn([[], False, False])
cinder.volume_list(IsA(
http.HttpRequest)).AndReturn(self.cinder_volumes.list())
cinder.extension_supported(IsA(http.HttpRequest), 'AvailabilityZones')\
@ -702,7 +702,7 @@ class VolumeViewTests(test.TestCase):
cinder.availability_zone_list(IsA(http.HttpRequest)).AndReturn(
self.cinder_availability_zones.list())
quotas.tenant_limit_usages(IsA(http.HttpRequest)).\
AndReturn(usage_limit)
AndReturn(usage_limit)
self.mox.ReplayAll()
@ -761,17 +761,17 @@ class VolumeViewTests(test.TestCase):
cinder.volume_backup_supported(IsA(http.HttpRequest)). \
MultipleTimes().AndReturn(True)
cinder.volume_list(IsA(http.HttpRequest), search_opts=None).\
AndReturn(volumes)
AndReturn(volumes)
cinder.volume_delete(IsA(http.HttpRequest), volume.id).\
AndRaise(exc)
AndRaise(exc)
api.nova.server_list(IsA(http.HttpRequest), search_opts=None).\
AndReturn([self.servers.list(), False])
AndReturn([self.servers.list(), False])
cinder.volume_list(IsA(http.HttpRequest), search_opts=None).\
AndReturn(volumes)
AndReturn(volumes)
api.nova.server_list(IsA(http.HttpRequest), search_opts=None).\
AndReturn([self.servers.list(), False])
AndReturn([self.servers.list(), False])
cinder.tenant_absolute_limits(IsA(http.HttpRequest)).MultipleTimes().\
AndReturn(self.cinder_limits['absolute'])
AndReturn(self.cinder_limits['absolute'])
self.mox.ReplayAll()
url = VOLUME_INDEX_URL
@ -868,9 +868,9 @@ class VolumeViewTests(test.TestCase):
volume = self.cinder_volumes.list()[0]
cinder.volume_get(IsA(http.HttpRequest), volume.id) \
.AndReturn(volume)
.AndReturn(volume)
api.nova.server_list(IsA(http.HttpRequest)) \
.AndReturn([servers, False])
.AndReturn([servers, False])
self.mox.ReplayAll()
@ -899,14 +899,14 @@ class VolumeViewTests(test.TestCase):
create_link = tables.CreateSnapshot()
url = reverse(create_link.get_link_url(), args=[volume.id])
res_url = VOLUME_INDEX_URL + \
"?action=row_update&table=volumes&obj_id=" + volume.id
res_url = (VOLUME_INDEX_URL +
"?action=row_update&table=volumes&obj_id=" + volume.id)
res = self.client.get(res_url, {},
HTTP_X_REQUESTED_WITH='XMLHttpRequest')
HTTP_X_REQUESTED_WITH='XMLHttpRequest')
classes = list(create_link.get_default_classes())\
+ list(create_link.classes)
classes = (list(create_link.get_default_classes())
+ list(create_link.classes))
link_name = "%s (%s)" % (unicode(create_link.verbose_name),
"Quota exceeded")
expected_string = "<a href='%s' class=\"%s disabled\" "\
@ -928,11 +928,11 @@ class VolumeViewTests(test.TestCase):
api.cinder.volume_backup_supported(IsA(http.HttpRequest)). \
MultipleTimes().AndReturn(True)
cinder.volume_list(IsA(http.HttpRequest), search_opts=None)\
.AndReturn(volumes)
.AndReturn(volumes)
api.nova.server_list(IsA(http.HttpRequest), search_opts=None)\
.AndReturn([self.servers.list(), False])
.AndReturn([self.servers.list(), False])
cinder.tenant_absolute_limits(IsA(http.HttpRequest))\
.MultipleTimes().AndReturn(limits)
.MultipleTimes().AndReturn(limits)
self.mox.ReplayAll()
res = self.client.get(VOLUME_INDEX_URL)
@ -943,8 +943,8 @@ class VolumeViewTests(test.TestCase):
create_link = tables.CreateVolume()
url = create_link.get_link_url()
classes = list(create_link.get_default_classes())\
+ list(create_link.classes)
classes = (list(create_link.get_default_classes())
+ list(create_link.classes))
link_name = "%s (%s)" % (unicode(create_link.verbose_name),
"Quota exceeded")
expected_string = "<a href='%s' title='%s' class='%s disabled' "\
@ -999,11 +999,11 @@ class VolumeViewTests(test.TestCase):
self.mox.ReplayAll()
url = VOLUME_INDEX_URL + \
"?action=row_update&table=volumes&obj_id=" + volume.id
url = (VOLUME_INDEX_URL +
"?action=row_update&table=volumes&obj_id=" + volume.id)
res = self.client.get(url, {},
HTTP_X_REQUESTED_WITH='XMLHttpRequest')
HTTP_X_REQUESTED_WITH='XMLHttpRequest')
self.assertEqual(res.status_code, 200)
self.assertEqual(volume.name, volume.id)
@ -1162,8 +1162,8 @@ class VolumeViewTests(test.TestCase):
self.mox.ReplayAll()
url = VOLUME_INDEX_URL + \
"?action=row_update&table=volumes&obj_id=" + volume.id
url = (VOLUME_INDEX_URL +
"?action=row_update&table=volumes&obj_id=" + volume.id)
res = self.client.get(url, {}, HTTP_X_REQUESTED_WITH='XMLHttpRequest')
@ -1186,8 +1186,8 @@ class VolumeViewTests(test.TestCase):
self.mox.ReplayAll()
url = VOLUME_INDEX_URL + \
"?action=row_update&table=volumes&obj_id=" + volume.id
url = (VOLUME_INDEX_URL +
"?action=row_update&table=volumes&obj_id=" + volume.id)
res = self.client.get(url, {}, HTTP_X_REQUESTED_WITH='XMLHttpRequest')