Ver Fonte

add test for get_cipher

oz123 há 11 anos atrás
pai
commit
0afbe903ea
2 ficheiros alterados com 8 adições e 3 exclusões
  1. 7 3
      tests/crypto_tests.py
  2. 1 0
      tests/test_pwman.py

+ 7 - 3
tests/crypto_tests.py

@@ -3,7 +3,7 @@ import os
 import pwman.data.factory
 from pwman.data.nodes import NewNode
 from pwman.data.tags import Tag
-from pwman.util.crypto import CryptoEngine, CryptoException
+from pwman.util.crypto import CryptoEngine, CryptoException, CryptoNoCallbackException
 # set cls_timout to negative number (e.g. -1) to disable
 default_config = {'Global': {'umask': '0100', 'colors': 'yes',
                              'cls_timeout': '5'
@@ -25,8 +25,12 @@ class CryptoTest(unittest.TestCase):
         config.set_value('Encryption', 'algorithm', '')
         self.assertRaises((CryptoException,), CryptoEngine)
 
-        # TODO: write a white box test for each
-        #       method in CryptoEngine
+    def test_getcipher(self):
+        crypto = CryptoEngine()
+        self.assertRaises((CryptoNoCallbackException,), crypto._getcipher)
 
+    def test_prepare_data(self):
+        obj='dummy_data'
+        self.assertTrue(True)
 
 

+ 1 - 0
tests/test_pwman.py

@@ -123,5 +123,6 @@ except SystemExit, e:
 import unittest
 from db_tests import CLITests
 from db_tests import DBTests
+from crypto_tests import CryptoTest
 if __name__ == '__main__':
     unittest.main()