0

I am running the Lettuce built-in server to test that it returns a given reponse however, it shows a 500 response.

My features file: Feature: home page loads

Scenario: Check that home page loads with header
  Given I access the home url
  then the home page should load with the title "Movies currently showing"

My steps file:

@step(u'Given I access the home url')
  def given_i_access_the_home_url(step):
    world.response = world.browser.get(django_url('/'))
    sleep(10)


@step(u'then the home page should load with the title "([^"]*)"')
def then_the_home_page_should_load_with_the_title_group1(step, group1):
  assert group1 in world.response

My Terrains file:

from django.core.management import call_command
from django.test.simple import DjangoTestSuiteRunner

from lettuce import before, after, world
from logging import getLogger
from selenium import webdriver

try:
from south.management.commands import patch_for_test_db_setup
except:
pass

logger = getLogger(__name__)
logger.info("Loading the terrain file...")



@before.runserver
def setup_database(actual_server):
'''
This will setup your database, sync it, and run migrations if you are using South.
It does this before the Test Django server is set up.
'''
logger.info("Setting up a test database...")

# Uncomment if you are using South
# patch_for_test_db_setup()

world.test_runner = DjangoTestSuiteRunner(interactive=False)
DjangoTestSuiteRunner.setup_test_environment(world.test_runner)
world.created_db = DjangoTestSuiteRunner.setup_databases(world.test_runner)

call_command('syncdb', interactive=False, verbosity=0)

# Uncomment if you are using South
# call_command('migrate', interactive=False, verbosity=0)

@after.runserver
def teardown_database(actual_server):
'''
This will destroy your test database after all of your tests have executed.
'''
logger.info("Destroying the test database ...")

DjangoTestSuiteRunner.teardown_databases(world.test_runner, world.created_db)

@before.all
def setup_browser():
world.browser = webdriver.Firefox()

@after.all
def teardown_browser(total):
world.browser.quit()

What could be the problem with the server, why a 500 response error?

zurik
  • 491
  • 1
  • 8
  • 21

1 Answers1

0

I managed to find what the problem is, the migrations were not running on syncdb

zurik
  • 491
  • 1
  • 8
  • 21