Advertisement
Guest User

Tes tController Client

a guest
Dec 6th, 2016
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.15 KB | None | 0 0
  1. import unittest
  2. from validator.ClientValidator import ClientValidator
  3. from repository.NoFilesRepo import NoFilesRepo
  4. from controller.ClientController import ClientController
  5.  
  6. class Test(unittest.TestCase):
  7.  
  8.  
  9.     def setUp(self):
  10.         self.__cv = ClientValidator()
  11.         self.__repo = NoFilesRepo()
  12.         self.__cc = ClientController(self.__cv,self.__repo)
  13.  
  14.     def tearDown(self):
  15.         del self.__cv
  16.         del self.__cc
  17.         del self.__repo
  18.        
  19.     def testClientController(self):
  20.         cl = self.__cc.add_client("1", "Naruto", "1234567890123")
  21.         assert (cl.ident == "1")
  22.         assert (cl.name == "Naruto")
  23.         assert (cl.cnp == "1234567890123")
  24.         listcl = self.__cc.client_list()
  25.         assert(len(listcl)==1)
  26.         self.__cc.update_client("1", "", "1111111111111")
  27.         assert (cl.ident == "1")
  28.         assert (cl.name == "Naruto")
  29.         assert (cl.cnp == "1111111111111")
  30.         self.__cc.remove_client("1")
  31.         listcl1 = self.__cc.client_list()
  32.         assert(len(listcl1)==0)
  33.        
  34.  
  35. if __name__ == "__main__":
  36.     #import sys;sys.argv = ['', 'Test.testName']
  37.     unittest.main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement