creating initial database entries and flushing before each test

26 views
Skip to first unread message

Richard Zulu

unread,
Feb 23, 2014, 4:08:44 AM2/23/14
to lettuc...@googlegroups.com
I am a novice to using lettuce for BDD development in Django however, I need help (code structure) in figuring out how i can load initial test data for my models and also how to flush them before each test.

Michel Sabchuk

unread,
Jul 1, 2014, 12:35:48 PM7/1/14
to lettuc...@googlegroups.com
Hi,

You may use something like:

from django.core.management import call_command

@before.each_scenario                                                         
def reset_data(scenario):                                                     
    call_command('flush', interactive=False, verbosity=0)                     
    call_command('loaddata', 'some_fixture.json', verbosity=0)    
Reply all
Reply to author
Forward
0 new messages