def testRemoveTextReminder(self): """ Test that we can adjust a text reminder. """ event = test_utils.create_event() reminder = TextReminder( user=self.user, action=event, text_number="8085551234", text_carrier="att", send_at=event.event_date - datetime.timedelta(hours=2), ) reminder.save() reminder_count = self.user.textreminder_set.count() response = self.client.post(reverse("activity_reminder", args=(event.type, event.slug,)), { "send_email": False, "email": "", "email_advance": "1", "send_text": False, "text_number": "", "text_carrier": "sprint", "text_advance": "1", }, HTTP_X_REQUESTED_WITH="XMLHttpRequest") self.failUnlessEqual(response.status_code, 200) self.assertEqual(self.user.textreminder_set.count(), reminder_count - 1, "User should not have a reminder.")
def testRemoveTextReminder(self): """ Test that we can adjust a text reminder. """ event = test_utils.create_event() reminder = TextReminder( user=self.user, action=event, text_number="8085551234", text_carrier="att", send_at=event.event_date - datetime.timedelta(hours=2), ) reminder.save() reminder_count = self.user.textreminder_set.count() response = self.client.post(reverse("activity_reminder", args=( event.type, event.slug, )), { "send_email": False, "email": "", "email_advance": "1", "send_text": False, "text_number": "", "text_carrier": "sprint", "text_advance": "1", }, HTTP_X_REQUESTED_WITH="XMLHttpRequest") self.failUnlessEqual(response.status_code, 200) self.assertEqual(self.user.textreminder_set.count(), reminder_count - 1, "User should not have a reminder.")
def testChangeTextReminder(self): """ Test that we can adjust a text reminder. """ event = test_utils.create_event() original_date = event.event_date - datetime.timedelta(hours=2) reminder = TextReminder( user=self.user, action=event, text_number="8085551234", text_carrier="att", send_at=original_date, ) reminder.save() reminder_count = self.user.textreminder_set.count() response = self.client.post(reverse("activity_reminder", args=( event.type, event.slug, )), { "send_email": False, "email": "", "email_advance": "1", "send_text": True, "text_number": "18085556789", "text_carrier": "sprint", "text_advance": "1", }, HTTP_X_REQUESTED_WITH="XMLHttpRequest") self.failUnlessEqual(response.status_code, 200) reminder = self.user.textreminder_set.get(action=event) # print profile.contact_text profile = Profile.objects.get(user=self.user) self.assertEqual(reminder.text_number, "808-555-6789", "Text number should have updated.") self.assertEqual(profile.contact_text, "808-555-6789", "Profile text number should have updated.") self.assertNotEqual(reminder.send_at, original_date, "Send time should have changed.") self.assertEqual(self.user.textreminder_set.count(), reminder_count, "No new reminders should have been created.")
def testChangeTextReminder(self): """ Test that we can adjust a text reminder. """ event = test_utils.create_event() original_date = event.event_date - datetime.timedelta(hours=2) reminder = TextReminder( user=self.user, action=event, text_number="8085551234", text_carrier="att", send_at=original_date, ) reminder.save() reminder_count = self.user.textreminder_set.count() response = self.client.post(reverse("activity_reminder", args=(event.type, event.slug,)), { "send_email": False, "email": "", "email_advance": "1", "send_text": True, "text_number": "18085556789", "text_carrier": "sprint", "text_advance": "1", }, HTTP_X_REQUESTED_WITH="XMLHttpRequest") self.failUnlessEqual(response.status_code, 200) reminder = self.user.textreminder_set.get(action=event) # print profile.contact_text profile = Profile.objects.get(user=self.user) self.assertEqual(reminder.text_number, "808-555-6789", "Text number should have updated.") self.assertEqual(profile.contact_text, "808-555-6789", "Profile text number should have updated.") self.assertNotEqual(reminder.send_at, original_date, "Send time should have changed.") self.assertEqual(self.user.textreminder_set.count(), reminder_count, "No new reminders should have been created.")