Esempio n. 1
0
    def test_expire_cosent_log_deos_run_if_there_is_reecent_expiry_but_force_is_specified(self,):
        ##Nb test app sett max Period to 7 days.abs
        models.ExpiryLog.objects.create(run_reason="dummy run for test")
        with unittest.mock.patch.object(models.ConsentRecord.objects,'delete_expired') as de:
            models.expire_consent_log(force= True)

        de.assert_called_once()
Esempio n. 2
0
 def test_expire_conset_log_inserts_into_the_expiry_log_with_passed_reason_value(self,):
     reason = "Test reason for expiry"
     log_entries_known = set(models.ExpiryLog.objects.all().values_list('pk'))
     models.expire_consent_log(reason = reason)
     new_logs = set(models.ExpiryLog.objects.all().values_list('pk'))
     new_entry = new_logs -  log_entries_known
     self.assertEqual(len(new_entry),1)
     new_entry = next(iter(new_entry))
     new_record = models.ExpiryLog.objects.get(pk=new_entry[0])
     self.assertEqual(new_record.run_reason,reason)
Esempio n. 3
0
 def test_expire_consent_log_inserts_into_the_expiry_log(self,):
     records = models.ExpiryLog.objects.all().count()
     models.expire_consent_log()
     self.assertEqual(models.ExpiryLog.objects.all().count(),records + 1)
Esempio n. 4
0
    def test_expire_consent_log_calls_qs_delete_expired(self,):
        with unittest.mock.patch.object(models.ConsentRecord.objects,'delete_expired') as de:
            models.expire_consent_log()

        de.assert_called_once()