Created
February 20, 2013 20:03
-
-
Save felipecruz/4998966 to your computer and use it in GitHub Desktop.
Generate models tests boilerplate code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.conf import settings | |
from django.db.models import get_apps, get_app, get_models | |
app = get_app('realestate') | |
source = ''' | |
class %sTest(TestCase): | |
def test_import(self): | |
from %s import %s | |
''' | |
app_full_name = app.__name__ | |
for model in get_models(app): | |
model_name = model._meta.object_name | |
print(source % (model_name, app_full_name, model_name)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment