Exemplo n.º 1
0
    def test_get_special_days(self):
        """
        Test get_special_days method
        """
        create_special_day(self.fridge)
        create_special_day(self.fridge, from_date=5, to_date=10)

        self.assertEqual(self.fridge.get_special_days().count(), 2)
Exemplo n.º 2
0
 def test_date_and_time(self):
     """
     if two date are selected, you can't select hour
     """
     with self.assertRaises(ValidationError):
         create_special_day(self.fridge,
                            from_date=0,
                            to_date=1,
                            from_hour=0)
Exemplo n.º 3
0
    def test_from_date_to_hour(self):
        """
        Valid from_date and to_hour values
        """
        sd = create_special_day(self.fridge, from_date=0, to_hour=1)

        self.assertIsNotNone(sd)
        self.assertEqual(len(SpecialDay.objects.all()), 1)
Exemplo n.º 4
0
    def test_from_date(self):
        """
        Only from_date value
        """
        sd = create_special_day(self.fridge, from_date=0)

        self.assertIsNotNone(sd)
        self.assertEqual(len(SpecialDay.objects.all()), 1)
Exemplo n.º 5
0
 def test_invalid_argument(self):
     """
     missing from_date
     """
     with self.assertRaises(ValidationError):
         create_special_day(self.fridge, to_date=0, from_hour=0)
Exemplo n.º 6
0
 def test_to_date_equal_from_date(self):
     """
     to_date == from_date : raise ValidationError exception
     """
     with self.assertRaises(ValidationError):
         create_special_day(self.fridge, to_date=0, from_date=0)
Exemplo n.º 7
0
 def test_to_hour_before_from_hour(self):
     """
     to_hour < from_hour : raise ValidationError exception
     """
     with self.assertRaises(ValidationError):
         create_special_day(self.fridge, to_hour=0, from_hour=1)