Django生菜,装载固定装置

时间:2014-03-05 19:46:04

标签: django lettuce

我正在尝试将我的灯具中的数据插入到测试数据库中,以便我可以测试我的视图,但是灯具不会加载到Django生菜中。

我的步骤文件

@step(u'Given I have the following movies')
def given_i_have_the_following_movies(step):
    for movie in step.hashes:
        movies = Movie(**movie)
        movies.save()


@step(u'then I should see my movies listed on the home page')
def then_i_should_see_my_movies_listed_on_the_home_page(step):
    for movie in step.hashes:
        assert movie['title'] in world.browser.page_source
        assert movie['actors'] in world.browser.page_source
        assert movie['running_time'] in world.browser.page_source
        assert movie['showtime'] in world.browser.page_source

我的灯具文件

[{"pk": 1, "model": "ticketing.movie", "fields": {"title": "Robocop(2014)", "actors": "Joel Kinnaman, Gary Oldman, Michael Keaton", "running_time":"105 mins", "showtime":"9.30pm"}},

如何在收获运行后加载灯具文件?

1 个答案:

答案 0 :(得分:1)

您可以在讨论@before.each_scenario中使用here

您还应该查看@after.harvest