Skip to content

Instantly share code, notes, and snippets.

@jeanphix
Created November 29, 2011 19:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jeanphix/1406053 to your computer and use it in GitHub Desktop.
Save jeanphix/1406053 to your computer and use it in GitHub Desktop.
django testing with ghost.py
import unittest
import os
import django.core.handlers.wsgi
from ghost import GhostTestCase
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
app = django.core.handlers.wsgi.WSGIHandler()
class MyTest(GhostTestCase):
port = 5000
def create_app(self):
return app
def test_open_home(self):
page, ressources = self.ghost.open("http://localhost:%s/" % self.port)
self.assertEqual(page.http_status, 200)
if __name__ == '__main__':
unittest.main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment