diff --git a/openstack_dashboard/dashboards/admin/metadata_defs/tests.py b/openstack_dashboard/dashboards/admin/metadata_defs/tests.py index bcc1ac3971..d01e08adea 100644 --- a/openstack_dashboard/dashboards/admin/metadata_defs/tests.py +++ b/openstack_dashboard/dashboards/admin/metadata_defs/tests.py @@ -258,7 +258,7 @@ class MetadataDefinitionsCreateViewTest(test.BaseAdminViewTests): err_msg = ('There was a problem loading the namespace: ' 'Expecting value: line 1 column 1 (char 0).') - self.assertFormError(res, "form", None, [err_msg]) + self.assertFormError(res.context["form"], None, [err_msg]) def test_admin_metadata_defs_create_namespace_empty_json_post_raw(self): form_data = { @@ -269,8 +269,9 @@ class MetadataDefinitionsCreateViewTest(test.BaseAdminViewTests): res = self.client.post(reverse(constants.METADATA_CREATE_URL), form_data) - self.assertFormError(res, "form", None, ['No input was provided for ' - 'the namespace content.']) + self.assertFormError( + res.context["form"], None, + ['No input was provided for the namespace content.']) def test_admin_metadata_defs_create_namespace_empty_json_post_file(self): form_data = { @@ -281,8 +282,9 @@ class MetadataDefinitionsCreateViewTest(test.BaseAdminViewTests): res = self.client.post(reverse(constants.METADATA_CREATE_URL), form_data) - self.assertFormError(res, "form", None, ['No input was provided for ' - 'the namespace content.']) + self.assertFormError( + res.context["form"], None, + ['No input was provided for the namespace content.']) class MetadataDefinitionsUpdateViewTest(test.BaseAdminViewTests): diff --git a/openstack_dashboard/dashboards/identity/users/tests.py b/openstack_dashboard/dashboards/identity/users/tests.py index 232cad62fb..9306530e6c 100644 --- a/openstack_dashboard/dashboards/identity/users/tests.py +++ b/openstack_dashboard/dashboards/identity/users/tests.py @@ -263,7 +263,8 @@ class UsersViewTests(test.BaseAdminViewTests): res = self.client.post(USER_CREATE_URL, formData) - self.assertFormError(res, "form", None, ['Passwords do not match.']) + self.assertFormError(res.context["form"], None, + ['Passwords do not match.']) self.assert_mock_multiple_calls_with_same_arguments( self.mock_get_default_domain, 2, @@ -310,7 +311,7 @@ class UsersViewTests(test.BaseAdminViewTests): res = self.client.post(USER_CREATE_URL, formData) self.assertFormError( - res, "form", 'password', + res.context["form"], 'password', ['Password must be between 8 and 18 characters.']) self.assert_mock_multiple_calls_with_same_arguments( @@ -358,7 +359,7 @@ class UsersViewTests(test.BaseAdminViewTests): res = self.client.post(USER_CREATE_URL, formData) self.assertFormError( - res, "form", 'password', + res.context["form"], 'password', ['Password must be between 8 and 18 characters.']) self.assert_mock_multiple_calls_with_same_arguments( @@ -697,7 +698,7 @@ class UsersViewTests(test.BaseAdminViewTests): res = self.client.post(USER_CHANGE_PASSWORD_URL, formData) - self.assertFormError(res, "form", None, + self.assertFormError(res.context["form"], None, ['The admin password is incorrect.']) self.mock_user_get.assert_called_with(test.IsHttpRequest(), '1', admin=False) @@ -720,7 +721,7 @@ class UsersViewTests(test.BaseAdminViewTests): res = self.client.post(USER_CHANGE_PASSWORD_URL, formData) self.assertFormError( - res, "form", 'password', + res.context["form"], 'password', ['Password must be between 8 and 18 characters.']) self.mock_user_get.assert_called_once_with(test.IsHttpRequest(), '1', @@ -741,7 +742,7 @@ class UsersViewTests(test.BaseAdminViewTests): res = self.client.post(USER_CHANGE_PASSWORD_URL, formData) self.assertFormError( - res, "form", 'password', + res.context["form"], 'password', ['Password must be between 8 and 18 characters.']) self.mock_user_get.assert_called_once_with(test.IsHttpRequest(), '1', diff --git a/openstack_dashboard/dashboards/project/security_groups/tests.py b/openstack_dashboard/dashboards/project/security_groups/tests.py index 73c1abe207..9bc6dc7588 100644 --- a/openstack_dashboard/dashboards/project/security_groups/tests.py +++ b/openstack_dashboard/dashboards/project/security_groups/tests.py @@ -1042,7 +1042,7 @@ class SecurityGroupsViewTests(test.TestCase): 'etherype': 'IPv4', 'remote': 'cidr'} res = self.client.post(self.edit_url, formData) - self.assertFormError(res, 'form', 'cidr', + self.assertFormError(res.context['form'], 'cidr', 'Invalid version for IP address') self.assert_mock_multiple_calls_with_same_arguments( self.mock_security_group_list, 2, diff --git a/openstack_dashboard/dashboards/project/volumes/tests.py b/openstack_dashboard/dashboards/project/volumes/tests.py index 8455689b75..36f2905ef5 100644 --- a/openstack_dashboard/dashboards/project/volumes/tests.py +++ b/openstack_dashboard/dashboards/project/volumes/tests.py @@ -653,7 +653,7 @@ class VolumeViewTests(test.ResetImageAPIVersionMixin, test.TestCase): "snapshot_id=" + str(snapshot.id)]), formData, follow=True) self.assertEqual(res.redirect_chain, []) - self.assertFormError(res, 'form', None, + self.assertFormError(res.context['form'], None, "The volume size cannot be less than the " "snapshot size (40GiB)") self.assertEqual(3, self.mock_volume_type_list.call_count) @@ -830,7 +830,7 @@ class VolumeViewTests(test.ResetImageAPIVersionMixin, test.TestCase): msg = ("The volume size cannot be less than the " "image size (20.0\xa0GB)") - self.assertFormError(res, 'form', None, msg) + self.assertFormError(res.context['form'], None, msg) self.assertEqual(3, self.mock_volume_type_list.call_count) self.assertEqual(2, self.mock_volume_type_default.call_count) @@ -874,7 +874,7 @@ class VolumeViewTests(test.ResetImageAPIVersionMixin, test.TestCase): "image_id=" + str(image.id)]), formData, follow=True) self.assertEqual(res.redirect_chain, []) - self.assertFormError(res, 'form', None, + self.assertFormError(res.context['form'], None, "The volume size cannot be less than the " "image minimum disk size (30GiB)") self.assertEqual(3, self.mock_volume_type_list.call_count) @@ -1913,7 +1913,7 @@ class VolumeViewTests(test.ResetImageAPIVersionMixin, test.TestCase): url = reverse('horizon:project:volumes:extend', args=[volume.id]) res = self.client.post(url, formData) - self.assertFormError(res, "form", "new_size", + self.assertFormError(res.context["form"], "new_size", "Volume cannot be extended to 1000GiB as " "the maximum size it can be extended to is " "120GiB.") diff --git a/openstack_dashboard/dashboards/settings/password/tests.py b/openstack_dashboard/dashboards/settings/password/tests.py index 31a041022c..4702499d95 100644 --- a/openstack_dashboard/dashboards/settings/password/tests.py +++ b/openstack_dashboard/dashboards/settings/password/tests.py @@ -82,7 +82,8 @@ class ChangePasswordTests(test.TestCase): 'confirm_password': 'doesnotmatch'} res = self.client.post(INDEX_URL, formData) - self.assertFormError(res, "form", None, ['Passwords do not match.']) + self.assertFormError(res.context["form"], None, + ['Passwords do not match.']) @test.create_mocks({ api.keystone: ['user_get']})