mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-10-17 05:41:25 +02:00
@@ -12,6 +12,9 @@ from modoboa.lib import parameters
|
||||
|
||||
|
||||
class LoginForm(forms.Form):
|
||||
|
||||
"""User login form."""
|
||||
|
||||
username = forms.CharField(
|
||||
label=ugettext_lazy("Username"),
|
||||
widget=forms.TextInput(attrs={"class": "form-control"})
|
||||
|
||||
@@ -6,6 +6,27 @@ from modoboa.lib.tests import ModoTestCase
|
||||
from . import factories
|
||||
|
||||
|
||||
class AuthenticationTestCase(ModoTestCase):
|
||||
|
||||
"""Validate authentication scenarios."""
|
||||
|
||||
@classmethod
|
||||
def setUpTestData(cls):
|
||||
"""Create test data."""
|
||||
super(AuthenticationTestCase, cls).setUpTestData()
|
||||
cls.account = factories.UserFactory(
|
||||
username="user@test.com", groups=('SimpleUsers',)
|
||||
)
|
||||
|
||||
def test_authentication(self):
|
||||
"""Validate simple case."""
|
||||
self.clt.logout()
|
||||
data = {"username": "user@test.com", "password": "toto"}
|
||||
response = self.clt.post(reverse("core:login"), data)
|
||||
self.assertEqual(response.status_code, 302)
|
||||
self.assertTrue(response.url.endswith(reverse("core:user_index")))
|
||||
|
||||
|
||||
class ProfileTestCase(ModoTestCase):
|
||||
|
||||
@classmethod
|
||||
|
||||
Reference in New Issue
Block a user