def test_transaction_objects_mapped_for_all_models(db, default_namespace): """ Test that all subclasses of HasRevisions are mapped by the transaction_objects() function. """ assert set(HasRevisions.__subclasses__()).issubset(transaction_objects().values())
def transaction_objects(): """ Return the mapping from model name to API object name - which becomes the Transaction.object_type - for models that generate Transactions (i.e. models that implement the HasRevisions mixin). """ from inbox.models.mixins import HasRevisions return dict((m.__tablename__, m.API_OBJECT_NAME) for m in HasRevisions.__subclasses__())