mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-10-17 05:41:25 +02:00
fix tests for modoboa.core in python2
This commit is contained in:
@@ -29,7 +29,7 @@ class ImportDataForm(forms.Form):
|
||||
def clean_sepchar(self):
|
||||
if self.cleaned_data["sepchar"] == "":
|
||||
return ";"
|
||||
return str(self.cleaned_data["sepchar"])
|
||||
return self.cleaned_data["sepchar"]
|
||||
|
||||
|
||||
class ImportIdentitiesForm(ImportDataForm):
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import json
|
||||
|
||||
from testfixtures import compare
|
||||
|
||||
from django import forms
|
||||
@@ -53,12 +51,12 @@ class DashboardTestCase(ModoTestCase):
|
||||
url = reverse("core:dashboard")
|
||||
response = self.client.get(url)
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertIn("Latest news", str(response.content))
|
||||
self.assertIn("Latest news", response.content.decode('utf-8'))
|
||||
self.client.logout()
|
||||
self.client.login(username=self.dadmin.username, password="toto")
|
||||
response = self.client.get(url)
|
||||
self.assertEqual(response.status_code, 200)
|
||||
self.assertIn("Latest news", str(response.content))
|
||||
self.assertIn("Latest news", response.content.decode('utf-8'))
|
||||
self.client.logout()
|
||||
self.client.login(username=self.user.username, password="toto")
|
||||
response = self.client.get(url)
|
||||
|
||||
@@ -39,6 +39,7 @@ import ldap
|
||||
|
||||
from django.conf import settings
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.utils.encoding import smart_bytes
|
||||
|
||||
from modoboa.core.password_hashers import get_password_hasher
|
||||
from modoboa.lib.exceptions import InternalError
|
||||
@@ -119,8 +120,8 @@ class LDAPAuthBackend(object):
|
||||
('"%s"' % newpassword).encode('utf-16').lstrip('\377\376')
|
||||
)
|
||||
ldif = [(ldap.MOD_REPLACE,
|
||||
self.pwd_attr,
|
||||
self._crypt_password(newpassword))]
|
||||
smart_bytes(self.pwd_attr),
|
||||
smart_bytes(self._crypt_password(newpassword)))]
|
||||
try:
|
||||
self.conn.modify_s(user_dn, ldif)
|
||||
except ldap.LDAPError as e:
|
||||
|
||||
@@ -3,8 +3,6 @@
|
||||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import json
|
||||
|
||||
from django.core import management
|
||||
from django.test import TestCase
|
||||
|
||||
|
||||
Reference in New Issue
Block a user