Exemplo n.º 1
0
    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()
Exemplo n.º 2
0
    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()
Exemplo n.º 3
0
def setUp():
    db = config.get_db()
    db.open()
    author = create_author(db)
    author.save(db=db)
Exemplo n.º 4
0
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"],
Exemplo n.º 5
0
def setUp():
    db = config.get_db()
    db.open()
Exemplo n.º 6
0
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():
Exemplo n.º 7
0
def setUp():
    db = config.get_db()
    db.open()
    author = create_author(db)
Exemplo n.º 8
0
def setUp():
    db = config.get_db()
    db.open()