Merge "Allow 'Manage Host' to show membership action"

This commit is contained in:
Jenkins 2014-03-17 17:22:16 +00:00 committed by Gerrit Code Review
commit cd2665b6e2
3 changed files with 8 additions and 30 deletions

View File

@ -1,29 +0,0 @@
{% extends "horizon/common/_modal_form.html" %}
{% load i18n %}
{% load url from future %}
{% block form_id %}{% endblock %}
{% block form_action %}{% url 'horizon:admin:aggregates:manage_hosts' id%}{% endblock %}
{% block modal_id %}add_aggregate_modal{% endblock %}
{% block modal-header %}{% trans "Manage Hosts" %}{% endblock %}
{% block modal-body %}
<div class="left">
<fieldset>
{% include "horizon/common/_form_fields.html" %}
</fieldset>
</div>
<div class="right">
<h3>{% trans "Description" %}:</h3>
<p>{% blocktrans %}
Here you can add/remove hosts to the selected aggregate host.
Note that while a host can be a member of multiple aggregates, it can belong to one availability zone at most.
{% endblocktrans %}</p>
</div>
{% endblock %}
{% block modal-footer %}
<input class="btn btn-primary pull-right" type="submit" value="{% trans "Add Host" %}" />
<a href="{% url 'horizon:admin:aggregates:index' %}" class="btn secondary cancel close">{% trans "Cancel" %}</a>
{% endblock %}

View File

@ -7,5 +7,5 @@
{% endblock page_header %} {% endblock page_header %}
{% block main %} {% block main %}
{% include 'admin/aggregates/_manage_hosts.html' %} {% include 'horizon/common/_workflow.html' %}
{% endblock %} {% endblock %}

View File

@ -219,8 +219,15 @@ class AggregatesViewTests(test.BaseAdminViewTests):
class ManageHostsTests(test.BaseAdminViewTests): class ManageHostsTests(test.BaseAdminViewTests):
@test.create_stubs({api.nova: ('aggregate_get', 'host_list')})
def test_manage_hosts(self): def test_manage_hosts(self):
aggregate = self.aggregates.first() aggregate = self.aggregates.first()
api.nova.aggregate_get(IsA(http.HttpRequest), str(aggregate.id)) \
.AndReturn(aggregate)
api.nova.host_list(IsA(http.HttpRequest)) \
.AndReturn(self.hosts.list())
self.mox.ReplayAll()
res = self.client.get(reverse(constants.AGGREGATES_MANAGE_HOSTS_URL, res = self.client.get(reverse(constants.AGGREGATES_MANAGE_HOSTS_URL,
args=[aggregate.id])) args=[aggregate.id]))
self.assertEqual(res.status_code, 200) self.assertEqual(res.status_code, 200)