Exemplo n.º 1
0
 def test_validate(self):        
     dv = DisciplineValidator()
     d = Discipline(1, "d1", "p1")
     try:
         dv.validate(d)
         assert(True)
     except ValidatorError:
         assert(False)
     
     d = Discipline(1, "", "")
     try:
         dv.validate(d)
         assert(False)
     except ValidatorError:
         assert(True)
 def test_validate(self):        
     dv = DisciplineValidator()
     d = Discipline(1, "d1", "p1")
     try:
         dv.validate(d)
         assert(True)
     except ValidatorError:
         assert(False)
     
     d = Discipline(1, "", "")
     try:
         dv.validate(d)
         assert(False)
     except ValidatorError:
         assert(True)
 def test_validate(self):
     sv = StudentValidator()
     dv = DisciplineValidator()
     sdv = StudentDisciplineValidator()
     s = Student(1, "s1")
     d = Discipline(1, "d1", "p1")
     d1s1 = Student_Discipline(10,s.get_student_id() , d.get_discipline_id(),5)
     try:
         sv.validate(s)
         dv.validate(d)
         sdv.validate(d1s1)
         assert True
     except ValidatorError:
         assert False
     
     sv = StudentValidator()
     dv = DisciplineValidator()
     sdv = StudentDisciplineValidator()
     s = Student(1, "")
     d = Discipline(1, "", "")
     d1s1 = Student_Discipline(2, s.get_student_id() ,d.get_discipline_id(),5)
     try:
         sv.validate(s)
         dv.validate(d)
         sdv.validate(d1s1)
         assert False
     except ValidatorError:
         assert True
     
     sv = StudentValidator()
     dv = DisciplineValidator()
     sdv = StudentDisciplineValidator()
     s = Student(1, "s1")
     d = Discipline(1, "d1", "p1")
     d1s1 = Student_Discipline(3, s.get_student_id() ,d.get_discipline_id(),-5)
     try:
         sv.validate(s)
         dv.validate(d)
         sdv.validate(d1s1)
         assert False
     except ValidatorError:
         assert True
Exemplo n.º 4
0
 def test_validate(self):
     sv = StudentValidator()
     dv = DisciplineValidator()
     sdv = StudentDisciplineValidator()
     s = Student(1, "s1")
     d = Discipline(1, "d1", "p1")
     d1s1 = Student_Discipline(10,s.get_student_id() , d.get_discipline_id(),5)
     try:
         sv.validate(s)
         dv.validate(d)
         sdv.validate(d1s1)
         assert True
     except ValidatorError:
         assert False
     
     sv = StudentValidator()
     dv = DisciplineValidator()
     sdv = StudentDisciplineValidator()
     s = Student(1, "")
     d = Discipline(1, "", "")
     d1s1 = Student_Discipline(2, s.get_student_id() ,d.get_discipline_id(),5)
     try:
         sv.validate(s)
         dv.validate(d)
         sdv.validate(d1s1)
         assert False
     except ValidatorError:
         assert True
     
     sv = StudentValidator()
     dv = DisciplineValidator()
     sdv = StudentDisciplineValidator()
     s = Student(1, "s1")
     d = Discipline(1, "d1", "p1")
     d1s1 = Student_Discipline(3, s.get_student_id() ,d.get_discipline_id(),-5)
     try:
         sv.validate(s)
         dv.validate(d)
         sdv.validate(d1s1)
         assert False
     except ValidatorError:
         assert True