Beispiel #1
0
 def test_dni_uniqueness(self):
   s = Factory.create('student')
   s.is_valid()
   self.assertTrue(s.is_valid())
   
   s2 = Factory.build('student', {'dni': s.dni})
   self.assertFalse(s2.is_valid())
   self.assertIn('dni', s2.errors)
Beispiel #2
0
 def test_saved_if_valid(self):
   mov = Factory.build('movement')
   self.assertTrue(mov.is_valid())
   self.assertTrue(mov.save())
Beispiel #3
0
 def test_is_not_valid_if_amount_is_zero(self):
   mov = Factory.build('movement', {'amount': 0})
   self.assertFalse(mov.is_valid())
Beispiel #4
0
 def test_saved_if_valid(self):
   p = Factory.build('payment')
   self.assertTrue(p.is_valid())
   self.assertTrue(p.save())
Beispiel #5
0
 def test_is_not_valid_if_amount_is_zero(self):
   p = Factory.build('payment', {'amount': 0})
   self.assertFalse(p.is_valid())
Beispiel #6
0
 def test_deletes_its_schedules(self):
   r = Factory.create('room')
   s = Factory.build('schedule', {'room': r})
   self.klass.add_schedule(s)
   self.klass.delete()
   self.assertIs(schedule.Schedule.find(s.id), False)
Beispiel #7
0
 def _setUp(self):
   self.klass1 = Factory.create('klass', {'name': 'klass_1'})
   self.klass2 = Factory.create('klass', {'name': 'klass_2'})
   self.package = Factory.build('package')
   self.package.klasses = [self.klass1, self.klass2]
   self.package.save()