예제 #1
0
 def setUp(self):
     self.Rental = Rental('1', '2', '3', '2017-10-23', '2018-10-23', -1)
     self.repo = Repository('testRentals', 'testRentals')
     self.movieRepo = Repository('testMovies', 'TestClients')
     self.clientRepo = Repository('testClients', 'TestClients')
     self.controller = RentalController(self.repo, self.movieRepo,
                                        self.clientRepo)
예제 #2
0
 def test_raises(self):
     repo = Repository("testRentalsRental", "test")
     movieRepo = Repository("testRentalsMovie", "tes2")
     mc = MovieController(movieRepo)
     clientRepo = Repository("testRentalsClients", "test3")
     cc = ClientController(clientRepo)
     controller = RentalController(repo, cc, mc)
     self.controller.undo()
예제 #3
0
 def test_AddRental2(self):
     open("testRentalsRental", 'w').close()
     open("testRentalsMovie", 'w').close()
     open("testRentalsClients", 'w').close()
     repo = Repository("testRentalsRental", "test")
     movieRepo = Repository("testRentalsMovie", "tes2")
     mc = MovieController(movieRepo)
     mc.addMovie("2", "title", "sds", "action")
     clientRepo = Repository("testRentalsClients", "test3")
     cc = ClientController(clientRepo)
     cc.addClient('2', 'Ghita')
     controller = RentalController(repo, cc, mc)
     self.assertEqual(
         controller.addRental('2', '2', '2', "2017-10-23", "2018-10-23",
                              -1), True)
예제 #4
0
    def setUp(self):
        #TODO: finish testing
        disciplineRepository = Repository()
        studentRepository = Repository()
        gradeReposiotry = Repository()

        self.validator = Validator()

        self.disciplineController = DisciplineController(disciplineRepository)
        self.studentController = StudentController(studentRepository)
        self.gradeController = GradeController(gradeReposiotry)

        self.disciplineController.add(12, "Mathematics")
        self.disciplineController.add(13, "Mathematics")
        self.studentController.add(13, "Williams")
        self.studentController.add(12, "Williams")
        self.gradeController.add(12, 13, 9)
예제 #5
0
 def test_removeRental2(self):
     f = open("testRentalsRental", 'w')
     f.write("2, 2, 2,  2017-11-20, 2019-11-20, -1")
     f.close()
     f = open("testRentalsMovie", 'w')
     f.write("2, title, sdfs, action")
     f.close()
     f = open("testRentalsClients", 'w')
     f.write("2, title")
     f.close()
     repo = Repository("testRentalsRental", "test")
     movieRepo = Repository("testRentalsMovie", "tes2")
     mc = MovieController(movieRepo)
     clientRepo = Repository("testRentalsClients", "test3")
     cc = ClientController(clientRepo)
     controller = RentalController(repo, cc, mc)
     self.assertEqual(controller.removeRental('2'), True)
예제 #6
0
 def test_getRentalById2(self):
     f = open("testRentalsRental", 'w')
     f.write("2, 2, 2,  2017-11-20, 2019-11-20, -1")
     f.close()
     f = open("testRentalsMovie", 'w')
     f.write("2, title, sdfs, action")
     f.close()
     f = open("testRentalsClients", 'w')
     f.write("2, title")
     f.close()
     repo = Repository("testRentalsRental", "test")
     movieRepo = Repository("testRentalsMovie", "tes2")
     mc = MovieController(movieRepo)
     clientRepo = Repository("testRentalsClients", "test3")
     cc = ClientController(clientRepo)
     controller = RentalController(repo, cc, mc)
     rental = Rental("2", "2", "2", "2017-11-20", "2019-11-20", "-1")
     self.assertEqual(controller.getRentalById(2), rental)
예제 #7
0
 def test_UpdateRental(self):
     f = open("testRentalsRental", 'w')
     f.write("1, 1, 1,  2017-11-20, 2019-11-20, -1")
     f.close()
     f = open("testRentalsMovie", 'w')
     f.write("1, title, sdfs, action")
     f.close()
     f = open("testRentalsClients", 'w')
     f.write("1, title")
     f.close()
     repo = Repository("testRentalsRental", "test")
     movieRepo = Repository("testRentalsMovie", "tes2")
     mc = MovieController(movieRepo)
     clientRepo = Repository("testRentalsClients", "test3")
     cc = ClientController(clientRepo)
     controller = RentalController(repo, cc, mc)
     self.assertEqual(
         controller.updateRental('1', '1', '1', '1', '2017-01-23',
                                 '2017-11-20', -1), True)
예제 #8
0
 def test_search(self):
     c = MovieController(Repository("testSearch", "d"))
     c.addItem(Movie(3, "action", "sdf", "family"))
     self.assertEqual(c.searchMovieByGenre("action"), [])
     c.removeMovie(3)
     self.assertEqual(c.searchMovieByTitle("d"), [])
     self.assertEqual(c.searchMovieByDescription("descriere"), [])
     self.assertRaises(ValueError, c.searchMovieByDescription, "")
     self.assertRaises(ValueError, c.searchMovieByGenre, "")
     self.assertRaises(ValueError, c.searchMovieByTitle, "")
예제 #9
0
 def test_returnedMovie(self):
     f = open("testRentalsRental", 'w')
     f.write("1, 2, 2,  2017-11-20, 2019-11-20, -1")
     f.close()
     f = open("testRentalsMovie", 'w')
     f.write("1, title, sdfs, action")
     f.close()
     f = open("testRentalsClients", 'w')
     f.write("1, title")
     f.close()
     repo = Repository("testRentalsRental", "test")
     movieRepo = Repository("testRentalsMovie", "tes2")
     mc = MovieController(movieRepo)
     clientRepo = Repository("testRentalsClients", "test3")
     cc = ClientController(clientRepo)
     controller = RentalController(repo, cc, mc)
     self.assertEqual(controller.returnAMovie("1"), True)
     self.assertRaises(ValueError, controller.removeAllAppOfMovie, '2s')
     self.assertRaises(ValueError, controller.removeAllAppOfClient, '2s')
     self.assertRaises(ValueError, controller.updateClientIdFromRental,
                       '2s', '2')
예제 #10
0
 def test_RentalSetters(self):
     r = Rental(1, 2, 3, "2017-10-20", "2017-11-20", "2018-01-20")
     r.id = 4
     r.movieId = 5
     r.clientId = 6
     r.returnedDate = "2017-12-20"
     r.dueDate = "2017-12-20"
     r.rentedDate = "2017-08-09"
     a = r.dueDate
     a = r.returnedDate
     self.assertNotEqual(
         r, Rental(4, 5, 6, "2017-12-20", "2017-12-20", "2017-08-09"))
     repo = Repository("testRentalsRental", "test")
     movieRepo = Repository("testRentalsMovie", "tes2")
     mc = MovieController(movieRepo)
     clientRepo = Repository("testRentalsClients", "test3")
     cc = ClientController(clientRepo)
     controller = RentalController(repo, cc, mc)
     self.assertEqual(controller.lateRentals(), [])
     self.assertEqual(controller.allRentedMovies(), mc.getAllMovies())
     s = mc.getAllMovies()
     self.assertEqual(controller.mostRentedMoviesByNumber(),
                      controller.mostRentedMoviesByNumber())
     self.assertEqual(controller.mostRentedMoviesByDays(),
                      controller.mostRentedMoviesByDays())
     self.assertRaises(ValueError, controller.updateClientIdFromRental, "s",
                       "2")
     self.assertRaises(ValueError, controller.updateClientIdFromRental, "2",
                       "s")
     controller.removeAllAppOfClient("1")
     controller.removeAllAppOfMovie("1")
     controller.updateMovieIdFromRental("1", "1")
     controller.updateClientIdFromRental("1", "1")
     self.assertRaises(ValueError, controller.updateClientIdFromRental, "2",
                       "s")
     self.assertRaises(ValueError, controller.updateClientIdFromRental, "s",
                       "2")
예제 #11
0
 def setUp(self):
     self.movie = Movie(3, 'Titanic4', 'supers', 'action')
     self.repo = Repository('testMovies', 'testMovies')
     self.controller = MovieController(self.repo)
     if self.controller.getMovieById(77) is not False:
         self.controller.removeMovie(77)
     if self.controller.getMovieById(772) is not False:
         self.controller.removeMovie(772)
     if self.controller.getMovieById(773) is not False:
         self.controller.removeMovie(773)
     if self.controller.getMovieById(23) is False:
         self.controller.addMovie("23", "title", "description", "action")
     if self.controller.getMovieById('233333') is not False:
         self.controller.removeMovie('233333')
     if self.controller.getMovieById(20) is False:
         self.controller.addMovie("20", "title", "description", "action")
     if self.controller.getMovieById(200) is False:
         self.controller.addMovie("200", "title", "description", "action")
     if self.controller.getMovieById(90) is False:
         self.controller.addMovie("90", "title", "description", "action")
     if self.controller.getMovieById(123) is False:
         self.controller.addMovie("123", "title", "description", "action")
     if self.controller.getMovieById(234) is False:
         self.controller.addMovie("234", "title", "description", "action")
     if self.controller.getMovieById(33) is False:
         self.controller.addMovie("33", "title", "description", "action")
     if self.controller.getMovieById(90) is not False:
         self.controller.removeMovie(99)
     if self.controller.getMovieById(323) is False:
         self.controller.addMovie("323", "title", "description", "action")
     if self.controller.getMovieById(929) is not False:
         self.controller.removeMovie(929)
     if self.controller.getMovieById(33) is False:
         self.controller.addMovie("333", "title", "description", "action")
     if self.controller.getMovieById(939) is not False:
         self.controller.removeMovie(939)
 def setUp(self):
     self.Client = Client(3, 'name')
     self.repo = Repository('testClients', 'testClients')
     self.controller = ClientController(self.repo)
     if self.controller.getClientById(77) is not False:
         self.controller.removeClient(77)
     if self.controller.getClientById(772) is not False:
         self.controller.removeClient(772)
     if self.controller.getClientById(773) is not False:
         self.controller.removeClient(773)
     if self.controller.getClientById(23) is False:
         self.controller.addClient("23", "name")
     if self.controller.getClientById('233333') is not False:
         self.controller.removeClient('233333')
     if self.controller.getClientById(20) is False:
         self.controller.addClient("20", "name")
     if self.controller.getClientById(200) is False:
         self.controller.addClient("200", "name2")
     if self.controller.getClientById(90) is False:
         self.controller.addClient("90", "name3")
     if self.controller.getClientById(123) is False:
         self.controller.addClient("123", "tion")
     if self.controller.getClientById(234) is False:
         self.controller.addClient("234", "t")
     if self.controller.getClientById(33) is False:
         self.controller.addClient("33", "tit")
     if self.controller.getClientById(90) is not False:
         self.controller.removeClient(99)
     if self.controller.getClientById(323) is False:
         self.controller.addClient("323", "tit")
     if self.controller.getClientById(929) is not False:
         self.controller.removeClient(929)
     if self.controller.getClientById(33) is False:
         self.controller.addClient("333", "tin")
     if self.controller.getClientById(939) is not False:
         self.controller.removeClient(939)
예제 #13
0
from Repositories.Repository import Repository
from Controller.Controller import Controller
from UI.Console import Console
from Domain.Square import SquareValidator

if __name__ == '__main__':
    validator = SquareValidator()
    repository = Repository()
    controller = Controller(validator, repository)
    console = Console(controller)

    console.start()
예제 #14
0
 def test_GetAllMovies(self):
     repo2 = Repository('movieUpdateTest', "test2")
     movie = Movie("2", "223", '22320', 'action')
     controller2 = MovieController(repo2)
     l = controller2.getAllMovies()
     self.assertEqual(controller2.getAllMovies(), [movie])
예제 #15
0
 def setUp(self):
     self.repo = Repository("", "")
     pass
 def test_GetAllClients(self):
     repo2 = Repository('ClientUpdateTest', "test2")
     client = Client("2", "223")
     controller2 = ClientController(repo2)
     l = controller2.getAllClients()
     self.assertEqual(controller2.getAllClients(), [client])
예제 #17
0
파일: Test.py 프로젝트: adrianPascan/FP
    def setUp(self):

        self.validator = SquareValidator()
        self.repository = Repository()
        self.controller = Controller(self.validator, self.repository)