def testAddRepo(self): repo = FileRepo("test.txt", Assignment.fileRead, Assignment.fileWrite) a1 = Assignment(1, 'Ass1', 'Y.O.L.O.') a2 = Assignment(2, 'Ass2', 'MarianaMaria') repo.add(a1) self.assertEqual(repo.getAll(), [a1]) repo.add(a2) self.assertEqual(repo.getAll(), [a1, a2])
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()
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()
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()