def __init__(self): handlers = [ (urlpatterns['PostsHandler'], PostsHandler), (urlpatterns['FeedHandler'], FeedHandler), ] settings = config.appsettings tornado.web.Application.__init__(self, handlers, **settings) # Have one global connection to the blog DB across all handlers self.db = config.get_db()
def setUp(): db = config.get_db() db.open() author = create_author(db) author.save(db=db)
import dustbin.config as config import dustbin.api.model as model import tornado.web as web import json from dustbin.tests.helpers import * from nose.tools import * from tornado.httputil import HTTPHeaders db = config.get_db() author = create_author(db) username = SUBDOMAIN def setUp(): db = config.get_db() db.open() author = create_author(db) author.save(db=db) def tearDown(): db.clear() db.close() class NewPostTest(BaseTest): def test_post(self): post, response = self.create_post(db=db) assert response.headers["Location"] == post.url, "url was %s expected %s" % ( response.headers["Location"],
def setUp(): db = config.get_db() db.open()
import dustbin.config as config import json from nose.tools import * from dustbin.api.model import Lense, Feed, Post from dustbin.tests.helpers import * db = config.get_db() def setUp(): db = config.get_db() db.open() def tearDown(): db.clear() db.close() def test_create_lense(): author = create_author(db) l = Lense(name='facebook', subdomain=SUBDOMAIN, db=db, author=author).save() loaded = Lense().load(l.url, db=db) assert loaded == l return l def test_delete_lense():
def setUp(): db = config.get_db() db.open() author = create_author(db)