示例#1
0
 def testRent(self):
     self._rent = rent(self.__id, self.__movie, self.__customer)
     self.assertEqual(self.__id, 1)
     self.assertEqual(self.__movie, 10)
     self.assertEqual(self.__customer, 100)
     self.assertEqual(self._rent,
                      rent(self.__id, self.__movie, self.__customer))
示例#2
0
 def update(self, idR, idM, idC, status):
     '''
     updates a customer info
     parameters :  ->idR :unique rent id (integer no)
                   ->idM :unique movie id(integer no)
                   ->idC :unique customer id (integer no)
                   ->status :rent status ("rented"/"returned")
     '''
     r = rent(idR, idM, idC, status)
     self.__validator.validate(r)
     self.__repositoryR.modify(r)
示例#3
0
 def testReports(self):
     testRentDTO.testRentDTO(self)
     repoM=repository()
     repoC=repository()
     repoR=repository()
     repoM.store(movie(11,"Inception","..",".."))
     repoC.store(customer(10,"James",1231231231231))
     repoR.store(rent(10,11,10))
     self._srv=serviceReports(repoR,repoC,repoM)
     self._newRentDTO=rentDTO(10,10,"James",11,"Inception",10)
     self.assertEqual(len(self._srv.createTheDTOList()),1)
 def testRentService(self):
     testRepoRent.testRent(self)
     self._repoRent=repository()
     self._repoM=repository()
     self._repoC=repository()
     self._repoM.store(movie(12,"It","Horror","Orrible"))
     self._repoC.store(customer(13,"Tudor",1231121231231))
     
     self._validator=validatorRent()
     self._service=rentsService(self._repoM,self._repoC,self._repoRent,self._validator)
     self._service.createRent(10,12,13)
     self.assertEqual(self._service.getNrRents(),1)
     self._rent=rent(10,12,13)
     self.assertEqual(self._repoRent.find("id",self._rent.getId()),[self._rent])
示例#5
0
 def createRent(self, idR, idM, idC):
     '''
     creates a rent
     in:   ->idR:(int unique) the rent id
           ->idM:(int unique) the movie id
           ->idC:(int unique) the customer id
     out:the customer created
     '''
     r = rent(idR, idM, idC)
     self.__validator.validate(idR)
     cust = self.__repositoryC.getAll()
     mov = self.__repositoryM.getAll()
     self.__validator.validateMId(idM, mov)
     self.__validator.validateCId(idC, cust)
     self.__repositoryR.store(r)
     return r
示例#6
0
 def testName(self):
     testRent.testRent(self)
     self._repo=fileRepository(self._fileName,rent.readFromStr,rent.writeToStr)
     self._another=rent(1,10,100)
     self._repo.store(self._another)
     self.assertEqual(self._repo.find("id",1)[0].getMovie(),10)