test: Check that error is displayed on decode failure
This commit is contained in:
parent
5f0e1a524b
commit
ceb41e6106
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
import io
|
import io
|
||||||
|
import mock
|
||||||
import random
|
import random
|
||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
|
@ -1577,6 +1578,16 @@ class NewActiveNomComTests(TestCase):
|
||||||
login_testing_unauthorized(self,self.chair.user.username,url)
|
login_testing_unauthorized(self,self.chair.user.username,url)
|
||||||
response = self.client.get(url)
|
response = self.client.get(url)
|
||||||
self.assertEqual(response.status_code,200)
|
self.assertEqual(response.status_code,200)
|
||||||
|
# Check that we get an error if there's an encoding problem talking to openssl
|
||||||
|
# "\xc3\x28" is an invalid utf8 string
|
||||||
|
with mock.patch("ietf.nomcom.utils.pipe", return_value=(0, b"\xc3\x28", None)):
|
||||||
|
response = self.client.post(url, {'key': force_str(key)})
|
||||||
|
self.assertFormError(
|
||||||
|
response.context["form"],
|
||||||
|
None,
|
||||||
|
"An internal error occurred while adding your private key to your session."
|
||||||
|
f"Please contact the secretariat for assistance ({settings.SECRETARIAT_SUPPORT_EMAIL})",
|
||||||
|
)
|
||||||
response = self.client.post(url,{'key': force_str(key)})
|
response = self.client.post(url,{'key': force_str(key)})
|
||||||
self.assertEqual(response.status_code,302)
|
self.assertEqual(response.status_code,302)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue