def test_command(self):
        checkin = CheckinFactory()
        checkin.time = datetime.now() - timedelta(minutes=90)
        checkin.save()
        CheckinFactory()
        CheckinFactory()

        call_command('expire_checkins')
        self.assertEqual(Checkin.objects.filter(expired=True).count(), 1)
    def test_tag(self):
        """
        Should return the checkins for the place that are not yet expired.

        """
        # Two checkins that are valid
        checkin1_1 = CheckinFactory()
        CheckinFactory(place=checkin1_1.place)

        # One checkin that is expired
        checkin1_3 = CheckinFactory(place=checkin1_1.place)
        checkin1_3.expired = True
        checkin1_3.save()

        # One checkin that belongs to another place
        CheckinFactory()

        result = get_checkins(checkin1_1.place)
        self.assertEqual(result.count(), 2)