<filename>tests/testServiceCrud.py
import unittest
from time import sleep

import sys
import os,time

dname = os.path.dirname(__file__)
relpath = os.path.join(dname, '../MyCryptoKeys')
abspath = os.path.abspath(relpath)
sys.path.insert(0, abspath)
from services import crudService as cs
import handlers as hnd

class MainTestSuite(unittest.TestCase):
    """Basic test cases."""
    def testInsertConPassword(self):
        try:
            hnd.cyh.remove(hnd.ch.storagefile)
            hnd.cyh.remove(os.path.join(hnd.ch.config['localpath'], '.session'))
        except Exception as e:
            print(e)
            pass
        
        print('Insertando con password')
        cs.addElement(password='<PASSWORD>', name='hola', description='asdf', passphaser='asdf').printm()

    def testInsertSinPasswordUno(self):
        # Insertamos siin password
        print('Insertando sin password 1')
        cs.addElement(name='segundaEntrada', description='Esta es otra entrad', passphaser='asdf').printm()
        # LeemosPorNombre
        print('-------------')
        om = cs.list(mode='name',name='segundaEntrada')
        print(om.message)
        print('-------------')        
        print('Insertando sin password 2 después de que caduque la sesión')
        hnd.sh.closeSession()
        cs.addElement(name='terceraEntrada', description='Esta es deberia de fallar por sesion caducada', passphaser='asdf').printm()

        # Leemos 
        print('-------------')
        om = cs.list(password='<PASSWORD>',mode='all')
        print(om.message)



if __name__ == '__main__':
    unittest.main()

<filename>tests/testServiceCrud.py
import unittest
from time import sleep

import sys
import os,time

dname = os.path.dirname(__file__)
relpath = os.path.join(dname, '../MyCryptoKeys')
abspath = os.path.abspath(relpath)
sys.path.insert(0, abspath)
from services import crudService as cs
import handlers as hnd

class MainTestSuite(unittest.TestCase):
    """Basic test cases."""
    def testInsertConPassword(self):
        try:
            hnd.cyh.remove(hnd.ch.storagefile)
            hnd.cyh.remove(os.path.join(hnd.ch.config['localpath'], '.session'))
        except Exception as e:
            print(e)
            pass
        
        print('Insertando con password')
        cs.addElement(password='<PASSWORD>', name='hola', description='asdf', passphaser='asdf').printm()

    def testInsertSinPasswordUno(self):
        # Insertamos siin password
        print('Insertando sin password 1')
        cs.addElement(name='segundaEntrada', description='Esta es otra entrad', passphaser='asdf').printm()
        # LeemosPorNombre
        print('-------------')
        om = cs.list(mode='name',name='segundaEntrada')
        print(om.message)
        print('-------------')        
        print('Insertando sin password 2 después de que caduque la sesión')
        hnd.sh.closeSession()
        cs.addElement(name='terceraEntrada', description='Esta es deberia de fallar por sesion caducada', passphaser='asdf').printm()

        # Leemos 
        print('-------------')
        om = cs.list(password='<PASSWORD>',mode='all')
        print(om.message)



if __name__ == '__main__':
    unittest.main()

Basic test cases. # Insertamos siin password # LeemosPorNombre # Leemos