add tests for password schemes

This commit is contained in:
Anthony Bourguignon
2018-10-14 11:09:04 +02:00
parent 1836cee5fb
commit c0e296ae91
2 changed files with 13 additions and 1 deletions
@@ -4,6 +4,7 @@
from __future__ import unicode_literals
import os
import smtplib
from unittest import skipIf
@@ -23,6 +24,8 @@ except ImportError:
import mock
@override_settings(
DOVECOT_LOOKUP_PATH=["{}/doveadm".format(os.path.dirname(__file__))])
class AuthenticationTestCase(ModoTestCase):
"""Validate authentication scenarios."""
+10 -1
View File
@@ -35,7 +35,7 @@ SETTINGS_SAMPLE = {
"limits-enable_domain_limits": "False",
"csrfmiddlewaretoken": "SGgMVZsA4TPqoiV786TMST6xgOlhAf4F",
"limits-deflt_user_mailboxes_limit": "0",
"core-password_scheme": "sha512crypt",
"core-password_scheme": "plain",
"core-update_scheme": True,
"core-items_per_page": "30",
"limits-deflt_user_mailbox_aliases_limit": "0",
@@ -175,6 +175,15 @@ class SettingsTestCase(ModoTestCase):
settings = SETTINGS_SAMPLE.copy()
response = self.client.post(url, settings, format="json")
self.assertEqual(response.status_code, 200)
settings["core-password_scheme"] = "sha512crypt"
response = self.client.post(url, settings, format="json")
self.assertEqual(response.status_code, 400)
compare(response.json(), {
"form_errors": {"password_scheme": ["Select a valid choice. \
sha512crypt is not one of the available choices."]},
"prefix": "core"
})
settings["core-password_scheme"] = "plain"
settings["core-rounds_number"] = ""
response = self.client.post(url, settings, format="json")
self.assertEqual(response.status_code, 400)