mirror of
https://github.com/retspen/webvirtcloud
synced 2025-07-31 12:41:08 +00:00
Accounts app improvements and tests
This commit is contained in:
parent
8afef36656
commit
5172a9f619
20 changed files with 622 additions and 227 deletions
|
@ -204,6 +204,10 @@ class Instance(models.Model):
|
|||
def formats(self):
|
||||
return self.proxy.get_image_formats()
|
||||
|
||||
@cached_property
|
||||
def interfaces(self):
|
||||
return self.proxy.get_ifaces()
|
||||
|
||||
|
||||
class PermissionSet(models.Model):
|
||||
"""
|
||||
|
@ -211,8 +215,9 @@ class PermissionSet(models.Model):
|
|||
"""
|
||||
class Meta:
|
||||
default_permissions = ()
|
||||
permissions = [('clone_instances', 'Can clone instances'),
|
||||
('passwordless_console', _('Can access console without password')),
|
||||
]
|
||||
permissions = [
|
||||
('clone_instances', 'Can clone instances'),
|
||||
('passwordless_console', _('Can access console without password')),
|
||||
]
|
||||
|
||||
managed = False
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
{% for c_net in networks_host %}
|
||||
<option value="net:{{ c_net }}">Network {{ c_net }}</option>
|
||||
{% endfor %}
|
||||
{% for c_iface in interfaces_host %}
|
||||
{% for c_iface in instance.interfaces %}
|
||||
<option value="iface:{{ c_iface }}">Interface {{ c_iface }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
|
|
|
@ -393,7 +393,7 @@
|
|||
{% for c_net in networks_host %}
|
||||
<option value="net:{{ c_net }}" {% if c_net == network.nic %} selected {% endif %}>{% trans 'Network' %} {{ c_net }}</option>
|
||||
{% endfor %}
|
||||
{% for c_iface in interfaces_host %}
|
||||
{% for c_iface in instance.interfaces %}
|
||||
<option value="iface:{{ c_iface }}" {% if c_iface == network.nic %} selected {% endif %}>{% trans 'Interface' %} {{ c_iface }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
|
@ -657,9 +657,9 @@
|
|||
<tbody class="searchable">
|
||||
{% for userinstance in userinstances %}
|
||||
<tr>
|
||||
<td><a href="{% url 'account' userinstance.user.id %}">{{ userinstance.user }}</a></td>
|
||||
<td><a href="{% url 'accounts:account' userinstance.user.id %}">{{ userinstance.user }}</a></td>
|
||||
<td style="width:30px;">
|
||||
<a href="{% url 'user_instance_delete' userinstance.id %}?next={% url 'instances:instance' instance.id %}#users">
|
||||
<a href="{% url 'accounts:user_instance_delete' userinstance.id %}?next={% url 'instances:instance' instance.id %}#users">
|
||||
{% icon 'trash' %}
|
||||
</a>
|
||||
</td>
|
||||
|
|
|
@ -116,7 +116,7 @@ class InstancesTestCase(TestCase):
|
|||
self.assertEqual(instance.disks[0]['size'], 1024**3)
|
||||
|
||||
response = self.client.post(reverse('instances:resize_disk', args=[instance.id]), {
|
||||
'disk_size_vda': '2.0 GB',
|
||||
'disk_size_vda': '2',
|
||||
})
|
||||
self.assertRedirects(response, reverse('instances:instance', args=[instance.id]) + '#resize')
|
||||
|
||||
|
@ -449,9 +449,8 @@ class InstancesTestCase(TestCase):
|
|||
response = self.client.post(
|
||||
reverse('instances:destroy', args=[instance.id]),
|
||||
{'delete_disk': True},
|
||||
HTTP_REFERER=reverse('index'),
|
||||
)
|
||||
self.assertRedirects(response, reverse('instances', args=[compute.id]))
|
||||
self.assertRedirects(response, reverse('instances:index'))
|
||||
|
||||
# # create volume
|
||||
# response = self.client.post(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue