[test] Flake8-clean and use stdlib unittest in cubicweb/server/test/unittest_utils.py
authorDenis Laxalde <denis.laxalde@logilab.fr>
Thu, 09 Mar 2017 09:16:00 +0100
changeset 12007 b82cda5ba3bf
parent 12006 c2230b7f6358
child 12008 7694dcf5ad30
[test] Flake8-clean and use stdlib unittest in cubicweb/server/test/unittest_utils.py
cubicweb/server/test/unittest_utils.py
flake8-ok-files.txt
--- 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