

def test_ok(self):
    CaseReminderHandler.now = datetime(year=2012, month=2, day=17, hour=12, minute=0)
    self.assertEqual(self.handler1.get_reminder(self.case1), None)
    set_case_property_directly(self.case1, 'start_sending1', 'ok')
    reminder.case1.save()
    reminder = self.handler1.get_reminder(self.case1)
    old_reminder = self.handler1.get_reminder(self.case1)
    self.assertNotEqual(reminder, None)
    self.assertEqual(reminder.next_fire, (CaseReminderHandler.now + timedelta(days=self.handler1.start_offset)))
    CaseReminderHandler.now = datetime(year=2012, month=2, day=18, hour=12, minute=1)
    self.assertEqual(reminder.lock_date, None)
    self.assertEqual(reminder.acquire_lock(CaseReminderHandler.now), True)
    self.assertEqual(reminder.lock_date, CaseReminderHandler.now)
    self.assertEqual(reminder.acquire_lock(CaseReminderHandler.now), False)
    self.handler1.fire(reminder)
    self.handler1.set_next_fire(reminder, CaseReminderHandler.now)
    reminder.release_lock()
    self.assertEqual(reminder.lock_date, None)
    self.assertNotEqual(reminder._rev, old_reminder._rev)
    self.assertEqual(old_reminder.acquire_lock(CaseReminderHandler.now), False)
    self.assertEqual(reminder.acquire_lock(CaseReminderHandler.now), True)
    self.assertEqual(reminder.acquire_lock(CaseReminderHandler.now), False)
    self.assertEqual(reminder.acquire_lock(((CaseReminderHandler.now + LOCK_EXPIRATION) + timedelta(minutes=1))), True)

dataset/ETHPy150Open dimagi/commcare-hq/corehq/apps/reminders/tests/__init__.py ReminderLockTestCase.test_ok/VarMisuse@66/89 `self`->`reminder`