Example #1
0
    def test_empty_in_past(self):
        # a past date
        today = datetime.date.today()
        day = today - datetime.timedelta(days=30)

        actual = builder.add_slot(day, 10, self.add_client())
        expected = dict(hour=10, coach=None, client=None, availability='empty')

        assert actual == expected, actual
Example #2
0
    def test_filled_past(self):
        # a past date
        today = arrow.get(datetime.date.today())
        day = today - datetime.timedelta(days=30)

        user = models.User(id='uuid-id', fullname='Joe', username='******', password='******')
        coach = models.Coach(id='uuid-coach', user_id=user.id)
        client = models.Client(id='uuid-client', user_id=user.id, coach_id=coach.id)
        call = models.Call(
            id='uuid',
            coach_id=coach.id,
            client_id=client.id,
            timeslot=arrow.get(day).replace(hour=10).datetime)
        db.session.add(client)
        db.session.add(coach)
        db.session.add(call)
        db.session.commit()

        actual = builder.add_slot(day.date(), 10, client=client)
        expected = dict(hour=10, coach='uuid-coach', client='uuid-client', availability="past",
                        time='10:00 AM')

        assert actual == expected, actual