Fix failing tests under python3.8
In python3.8 cgi.escape function was removed as it is noted here : https://docs.python.org/3/whatsnew/3.8.html This patch is fixing security_groups tests and replacing escape func from cgi to escape func from django.utils.html. Change-Id: I5e47001dad730b64d4914e72df7d93ee15a1db12 Closes-Bug: #1854019
This commit is contained in:
parent
f592481cc0
commit
33fe0fef33
|
@ -16,13 +16,12 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import cgi
|
||||
|
||||
import mock
|
||||
import six
|
||||
|
||||
from django.conf import settings
|
||||
from django.urls import reverse
|
||||
from django.utils import html
|
||||
|
||||
from horizon import exceptions
|
||||
from horizon import forms
|
||||
|
@ -618,8 +617,7 @@ class SecurityGroupsViewTests(test.TestCase):
|
|||
'remote': 'cidr'}
|
||||
res = self.client.post(self.edit_url, formData)
|
||||
self.assertNoMessages()
|
||||
self.assertContains(res, cgi.escape('"from" port number is invalid',
|
||||
quote=True))
|
||||
self.assertContains(res, html.escape('"from" port number is invalid'))
|
||||
|
||||
# note that 'to_port' is not passed
|
||||
formData = {'method': 'AddRule',
|
||||
|
@ -631,8 +629,7 @@ class SecurityGroupsViewTests(test.TestCase):
|
|||
'remote': 'cidr'}
|
||||
res = self.client.post(self.edit_url, formData)
|
||||
self.assertNoMessages()
|
||||
self.assertContains(res, cgi.escape('"to" port number is invalid',
|
||||
quote=True))
|
||||
self.assertContains(res, html.escape('"to" port number is invalid'))
|
||||
|
||||
self.assert_mock_multiple_calls_with_same_arguments(
|
||||
self.mock_security_group_list, 6,
|
||||
|
|
Loading…
Reference in New Issue