def test_purge(self, db_session, factories, deleted, mins_ago, purged): updated = datetime.utcnow() - timedelta(minutes=mins_ago) annotation = factories.Annotation(deleted=deleted, updated=updated) db_session.add(annotation) purge_deleted_annotations() if purged: assert db_session.query(Annotation).count() == 0 else: assert db_session.query(Annotation).count() == 1