Django Django Boot Tester

How do you download test devices with the django-nose test runner?

+4
source share
3 answers
#settings.test.py INSTALLED_APPS += ('django_nose', ) TEST_RUNNER = 'django_nose.run_tests' #appname/tests.py from datetime import date,datetime, timedelta from django.contrib.auth.models import User from django.test.client import Client from django.test import TestCase class BetViewsTestCase(TestCase): #files placed in appname/fixtures/restaurant.json, appname/fixtures/map.json fixtures = ['authtestdata.json', 'restaurant.json', 'map.json'] 
+4
source

In your setup method, just call:

 management.call_command('loaddata', 'Category.json', verbosity=0) 

Then in talk mode, call:

 management.call_command('flush', verbosity=0, interactive=False) 

Here you can import controls:

 from django.core import management 
+2
source

Just make the test case a subclass of FastFixtureTestCase.

 from django_nose import FastFixtureTestCase from myapp.models import MyModel from nose_tools import eq_ class TestFixtureLoading(FastFixtureTestCase): fixtures = ['mymodel_data.yaml'] def test_fixture_loading(self): eq_(1, MyModel.objects.count()) 

And then:

 python manage.py test 
+2
source

All Articles