def test_it_handles_few(self, mock):
        yesterday = timezone.now() - timedelta(days=1)
        names = ["Check %d" % d for d in range(0, 10)]

        for name in names:
            check = Check(user=self.alice, name=name)
            check.alert_after = yesterday
            check.status = "up"
            check.save()

        result = handle_many()
        assert result, "handle_many should return True"

        handled_names = []
        for args, kwargs in mock.call_args_list:
            handled_names.append(args[0].name)

        assert set(names) == set(handled_names)
    def test_it_handles_few(self, mock):
        alice = User(username="******")
        alice.save()

        names = ["Check %d" % d for d in range(0, 10)]

        for name in names:
            check = Check(user=alice, name=name)
            check.alert_after = datetime(2000, 1, 1)
            check.status = "up"
            check.save()

        result = handle_many()
        assert result, "handle_many should return True"

        handled_names = []
        for args, kwargs in mock.call_args_list:
            handled_names.append(args[0].name)

        assert set(names) == set(handled_names)
    def test_it_handles_few(self, mock):
        alice = User(username="******")
        alice.save()

        names = ["Check %d" % d for d in range(0, 10)]

        for name in names:
            check = Check(user=alice, name=name)
            check.alert_after = datetime(2000, 1, 1)
            check.status = "up"
            check.save()

        result = handle_many()
        assert result, "handle_many should return True"

        handled_names = []
        for args, kwargs in mock.call_args_list:
            handled_names.append(args[0].name)

        assert set(names) == set(handled_names)