def testAdd(self):
     repo = FileRepo("test.txt", Assignment.fileRead, Assignment.fileWrite)
     srv = Service(repo)
     srv.addAssignment(1, 'Ass1', 'Y.O.L.O.')
     self.assertEqual(len(repo.getAll()), 1)
     srv.addAssignment(2, 'Ass2', 'MarianaMaria')
     self.assertEqual(len(repo.getAll()), 2)
     repo.clearRepo()
Example #2
0
 def testAddStud(self):
     repo = FileRepo("testStuds.txt", Student.fileRead, Student.fileWrite)
     srv = ExamSrv(repo)
     srv.addStud(12, 'Stud1 Stud1', 10, 9)
     self.assertEqual(len(repo.getAll()), 1)
     srv.addStud(13, 'Stud2 Stud2', 10, 9)
     self.assertEqual(len(repo.getAll()), 2)
     repo.clearRepo()
Example #3
0
 def testIncreaseUsage(self):
     BusRepo = FileRepo("testBuses.txt", Bus.fileRead, Bus.fileWrite)
     b1 = Bus(1, 1, 'b1', 2)
     BusRepo.addObj(b1)
     RouteRepo = FileRepo("testRoutes.txt", Route.fileRead, Route.fileWrite)
     srv = BusSrv(BusRepo, RouteRepo)
     srv.increaseUsage(1,1)
     self.assertEqual(b1.getTimesUsedRoute(),3)
     BusRepo.clearRepo()
Example #4
0
 def testSimulateNewDay(self):
     repo = FileRepo("test.txt", Person.fileRead, Person.fileWrite)
     srv = Service(repo)
     p1 = Person(1, 'nonvaccinated', 'ill')
     p2 = Person(2, 'nonvaccinated', 'healthy')
     p3 = Person(3, 'nonvaccinated', 'healthy')
     repo.add(p1)
     repo.add(p2)
     repo.add(p3)
     srv.simulateNewDay()
     self.assertEqual(p2.getStatus(), 'ill')
     srv.simulateNewDay()
     self.assertEqual(p3.getStatus(), 'ill')
     with self.assertRaises(AssertionError):
         assert p1.getStatus() == 'healthy'
     repo.clearRepo()
Example #5
0
 def testRepoAddStud(self):
     repo = FileRepo("testStuds.txt", Student.fileRead, Student.fileWrite)
     s1 = Student(1, "stud stud", 9, 9)
     repo.add(s1)
     self.assertEqual(repo.getAll(), [s1])
     repo.clearRepo()