Fix edit qos spec form exception

The Exception thrown because the given URL is not correct.
This patch adding the correct URL to edit the QoS spec,
Also add unit test to check template name and submit url.

Change-Id: I48b4c4f53ec97e6cdb0a4d8fc91c4c680a13e193
Closes-Bug: #1679436
This commit is contained in:
wei.ying 2017-04-04 08:34:33 +08:00
parent 689be59b4f
commit 2ee3f462ca
2 changed files with 8 additions and 2 deletions

View File

@ -16,6 +16,8 @@ from django import http
from mox3.mox import IsA
from openstack_dashboard import api
from openstack_dashboard.dashboards.admin.volume_types.qos_specs \
import views
from openstack_dashboard.test import helpers as test
@ -118,6 +120,10 @@ class QosSpecsTests(test.BaseAdminViewTests):
self.mox.ReplayAll()
resp = self.client.post(edit_url, data)
self.assertEqual('admin/volume_types/qos_specs/edit.html',
views.EditKeyValuePairView.template_name)
self.assertEqual('horizon:admin:volume_types:qos_specs:edit',
views.EditKeyValuePairView.submit_url)
self.assertNoFormErrors(resp)
self.assertMessageCount(success=1)
self.assertRedirectsNoFollow(resp, index_url)

View File

@ -97,9 +97,9 @@ class EditKeyValuePairView(QosSpecMixin, forms.ModalFormView):
form_class = project_forms.EditKeyValuePair
form_id = "qos_spec_edit_form"
modal_id = "qos_spec_edit_modal"
template_name = 'admin/volumes/volume_types/qos_specs/edit.html'
template_name = 'admin/volume_types/qos_specs/edit.html'
submit_label = _("Save")
submit_url = "horizon:admin:volumes:volume_types:qos_specs:edit"
submit_url = "horizon:admin:volume_types:qos_specs:edit"
url = 'horizon:admin:volume_types:index'
page_title = _("Edit {{ qos_spec_name }} Spec Value")