Beispiel #1
0
 def test_queryset_soft_delete_handles_additional_signs(self):
     get_additional_sign_real()
     additional_sign = get_additional_sign_real(parent=self.main_sign)
     self.assertEqual(TrafficSignReal.objects.count(), 2)
     TrafficSignReal.objects.filter(pk=self.main_sign.pk).soft_delete(
         self.user)
     self.main_sign.refresh_from_db()
     additional_sign.refresh_from_db()
     self.assertFalse(self.main_sign.is_active)
     self.assertEqual(self.main_sign.deleted_by, self.user)
     self.assertFalse(additional_sign.is_active)
     self.assertEqual(additional_sign.deleted_by, self.user)
     self.assertEqual(TrafficSignReal.objects.active().count(), 1)
     self.assertEqual(AdditionalSignReal.objects.active().count(), 1)
Beispiel #2
0
 def test_soft_delete_main_traffic_sign_also_soft_delete_additional_sign(
         self):
     additional_sign = get_additional_sign_real(parent=self.main_sign)
     self.main_sign.soft_delete(self.user)
     additional_sign.refresh_from_db()
     self.assertFalse(additional_sign.is_active)
     self.assertEqual(additional_sign.deleted_by, self.user)
Beispiel #3
0
 def test_has_additional_signs_return_yes(self):
     get_additional_sign_real(parent=self.traffic_sign_real)
     ma = TrafficSignRealAdmin(TrafficSignReal, self.site)
     self.assertEqual(ma.has_additional_signs(self.traffic_sign_real), "Kyllä")
Beispiel #4
0
 def test_has_additional_signs_return_false_with_soft_deleted_additional_sign(
         self):
     additional_sign = get_additional_sign_real(parent=self.main_sign)
     additional_sign.soft_delete(self.user)
     self.assertFalse(self.main_sign.has_additional_signs())
Beispiel #5
0
 def test_main_sign_has_additional_signs_return_true(self):
     get_additional_sign_real(parent=self.main_sign)
     self.assertTrue(self.main_sign.has_additional_signs())