[test] Flake8-clean and use stdlib unittest in cubicweb/server/test/unittest_utils.py
--- a/cubicweb/server/test/unittest_utils.py Tue Mar 07 12:08:39 2017 +0100
+++ b/cubicweb/server/test/unittest_utils.py Thu Mar 09 09:16:00 2017 +0100
@@ -15,23 +15,25 @@
#
# You should have received a copy of the GNU Lesser General Public License along
# with CubicWeb. If not, see <http://www.gnu.org/licenses/>.
-"""
+"""Tests for cubicweb.server.utils module."""
-"""
-from logilab.common.testlib import TestCase, unittest_main
+from unittest import TestCase
from cubicweb.server import utils
+
class UtilsTC(TestCase):
+
def test_crypt(self):
for hash in (
- utils.crypt_password('xxx'), # default sha512
- b'ab$5UsKFxRKKN.d8iBIFBnQ80', # custom md5
- b'ab4Vlm81ZUHlg', # DES
- ):
+ utils.crypt_password('xxx'), # default sha512
+ b'ab$5UsKFxRKKN.d8iBIFBnQ80', # custom md5
+ b'ab4Vlm81ZUHlg', # DES
+ ):
self.assertEqual(utils.crypt_password('xxx', hash), hash)
self.assertEqual(utils.crypt_password(u'xxx', hash), hash)
- self.assertEqual(utils.crypt_password(u'xxx', hash.decode('ascii')), hash.decode('ascii'))
+ self.assertEqual(utils.crypt_password(u'xxx', hash.decode('ascii')),
+ hash.decode('ascii'))
self.assertEqual(utils.crypt_password('yyy', hash), b'')
# accept any password for empty hashes (is it a good idea?)
@@ -40,4 +42,5 @@
if __name__ == '__main__':
- unittest_main()
+ import unittest
+ unittest.main()
--- a/flake8-ok-files.txt Tue Mar 07 12:08:39 2017 +0100
+++ b/flake8-ok-files.txt Thu Mar 09 09:16:00 2017 +0100
@@ -50,6 +50,7 @@
cubicweb/server/test/unittest_serverctl.py
cubicweb/server/test/unittest_session.py
cubicweb/server/test/unittest_rqlannotation.py
+cubicweb/server/test/unittest_utils.py
cubicweb/sobjects/test/unittest_notification.py
cubicweb/sobjects/test/unittest_register_user.py
cubicweb/sobjects/textparsers.py