mirror of https://github.com/snachodog/mybuddy.git
Remove outdated tests
This commit is contained in:
parent
4d1d915478
commit
716d121575
|
@ -129,21 +129,6 @@ class InitialValuesTestCase(FormsTestCaseBase):
|
||||||
self.assertTrue("start" not in page.context["form"].initial)
|
self.assertTrue("start" not in page.context["form"].initial)
|
||||||
self.assertTrue("end" not in page.context["form"].initial)
|
self.assertTrue("end" not in page.context["form"].initial)
|
||||||
|
|
||||||
def test_timer_stop_on_save(self):
|
|
||||||
timer = models.Timer.objects.create(
|
|
||||||
user=self.user, start=timezone.localtime() - timezone.timedelta(minutes=30)
|
|
||||||
)
|
|
||||||
params = {
|
|
||||||
"child": self.child.id,
|
|
||||||
"start": self.localtime_string(self.timer.start),
|
|
||||||
"end": self.localtime_string(),
|
|
||||||
}
|
|
||||||
page = self.c.post("/sleep/add/?timer={}".format(timer.id), params, follow=True)
|
|
||||||
self.assertEqual(page.status_code, 200)
|
|
||||||
self.timer.refresh_from_db()
|
|
||||||
self.assertFalse(self.timer.active)
|
|
||||||
self.assertEqual(self.localtime_string(self.timer.end), params["end"])
|
|
||||||
|
|
||||||
|
|
||||||
class BMIFormsTestCase(FormsTestCaseBase):
|
class BMIFormsTestCase(FormsTestCaseBase):
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@ -779,29 +764,6 @@ class TimerFormsTestCase(FormsTestCaseBase):
|
||||||
self.timer.refresh_from_db()
|
self.timer.refresh_from_db()
|
||||||
self.assertEqual(self.localtime_string(self.timer.start), params["start"])
|
self.assertEqual(self.localtime_string(self.timer.start), params["start"])
|
||||||
|
|
||||||
def test_edit_stopped(self):
|
|
||||||
self.timer.stop()
|
|
||||||
params = {
|
|
||||||
"name": "Edit stopped timer",
|
|
||||||
"start": self.localtime_string(self.timer.start),
|
|
||||||
"end": self.localtime_string(self.timer.end),
|
|
||||||
}
|
|
||||||
page = self.c.post(
|
|
||||||
"/timers/{}/edit/".format(self.timer.id), params, follow=True
|
|
||||||
)
|
|
||||||
self.assertEqual(page.status_code, 200)
|
|
||||||
|
|
||||||
def test_delete_inactive(self):
|
|
||||||
models.Timer.objects.create(user=self.user)
|
|
||||||
self.assertEqual(models.Timer.objects.count(), 2)
|
|
||||||
self.timer.stop()
|
|
||||||
page = self.c.post("/timers/delete-inactive/", follow=True)
|
|
||||||
self.assertEqual(page.status_code, 200)
|
|
||||||
messages = list(page.context["messages"])
|
|
||||||
self.assertEqual(len(messages), 1)
|
|
||||||
self.assertEqual(str(messages[0]), "All inactive timers deleted.")
|
|
||||||
self.assertEqual(models.Timer.objects.count(), 1)
|
|
||||||
|
|
||||||
|
|
||||||
class ValidationsTestCase(FormsTestCaseBase):
|
class ValidationsTestCase(FormsTestCaseBase):
|
||||||
def test_validate_date(self):
|
def test_validate_date(self):
|
||||||
|
|
|
@ -129,39 +129,6 @@ class TemplateTagsTestCase(TestCase):
|
||||||
url, "/sleep/add/?timer={}&child={}".format(timer.id, child.slug)
|
url, "/sleep/add/?timer={}&child={}".format(timer.id, child.slug)
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_datetimepicker_format(self):
|
|
||||||
request = MockUserRequest(get_user_model().objects.first())
|
|
||||||
request.user.settings.dashboard_hide_empty = True
|
|
||||||
context = {"request": request}
|
|
||||||
|
|
||||||
with self.settings(USE_24_HOUR_TIME_FORMAT=False):
|
|
||||||
self.assertEqual(datetime.datetimepicker_format(context), "L LT")
|
|
||||||
self.assertEqual(datetime.datetimepicker_format(context, "L LT"), "L LT")
|
|
||||||
self.assertEqual(datetime.datetimepicker_format(context, "L LTS"), "L LTS")
|
|
||||||
|
|
||||||
with self.settings(USE_24_HOUR_TIME_FORMAT=True):
|
|
||||||
self.assertEqual(datetime.datetimepicker_format(context), "L HH:mm")
|
|
||||||
self.assertEqual(datetime.datetimepicker_format(context, "L LT"), "L HH:mm")
|
|
||||||
self.assertEqual(
|
|
||||||
datetime.datetimepicker_format(context, "L LTS"), "L HH:mm:ss"
|
|
||||||
)
|
|
||||||
|
|
||||||
@override_settings(USE_24_HOUR_TIME_FORMAT=False)
|
|
||||||
def test_datetimepicker_format_en_gb(self):
|
|
||||||
user = get_user_model().objects.first()
|
|
||||||
user.settings.language = "en-GB"
|
|
||||||
user.save()
|
|
||||||
|
|
||||||
request = MockUserRequest(user)
|
|
||||||
request.user.settings.dashboard_hide_empty = True
|
|
||||||
context = {"request": request}
|
|
||||||
|
|
||||||
self.assertEqual(datetime.datetimepicker_format(context), "L h:mm a")
|
|
||||||
self.assertEqual(datetime.datetimepicker_format(context, "L LT"), "L h:mm a")
|
|
||||||
self.assertEqual(
|
|
||||||
datetime.datetimepicker_format(context, "L LTS"), "L h:mm:ss a"
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_datetime_short(self):
|
def test_datetime_short(self):
|
||||||
date = timezone.localtime()
|
date = timezone.localtime()
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
|
|
Loading…
Reference in New Issue