Exemple #1
0
    def setUp(self):
        database.initialize(SqliteDatabase(":memory:"))
        insertFixtures()

        app = CorkscrewApplication(PHF)
        app.register(Comment, endpoint="/comments")

        app.register(
            Person,
            related={"articles": Article},
            endpoint="/people"
        )

        app.register(
            Photo,
            related={"tags": Link(Tag, via=PhotoTag)},
            endpoint="/photos"
        )

        app.register(
            Article,
            related={
                "comments": Comment,
                "revisions": Link(Revision, on="parent")
            },
            endpoint="/articles"
        )

        self.app = TestApp(app)
Exemple #2
0
    def setUp(self):
        database.initialize(SqliteDatabase(":memory:"))
        insertFixtures()

        app = CorkscrewApplication(PHF)
        app.register(Comment, endpoint="/comments")

        app.register(Person, related={"articles": Article}, endpoint="/people")

        app.register(Photo,
                     related={"tags": Link(Tag, via=PhotoTag)},
                     endpoint="/photos")

        app.register(Article,
                     related={
                         "comments": Comment,
                         "revisions": Link(Revision, on="parent")
                     },
                     endpoint="/articles")

        self.app = TestApp(app)
Exemple #3
0
#!/usr/bin/env python
# coding: utf-8

from peewee import SqliteDatabase

from corkscrew import CorkscrewApplication
from corkscrew.handlers import PeeweeHandlerFactory as PHF
from corkscrew.fixtures import insertFixtures, database
from corkscrew.fixtures import Comment, Person, Photo, Article, Tag, PhotoTag

if __name__ == "__main__":
    database.initialize(SqliteDatabase(":memory:"))
    insertFixtures()

    app = CorkscrewApplication(PHF)
    app.register(Comment, endpoint="/comments")

    app.register(Person, related={"articles": Article}, endpoint="/people")

    app.register(Photo, related={"tags": (Tag, PhotoTag)}, endpoint="/photos")
    app.register(Article, related={"comments": Comment}, endpoint="/articles")

    app.run()
Exemple #4
0
#!/usr/bin/env python
# coding: utf-8

from peewee import SqliteDatabase

from corkscrew import CorkscrewApplication
from corkscrew.handlers import PeeweeHandlerFactory as PHF
from corkscrew.fixtures import insertFixtures, database
from corkscrew.fixtures import Comment, Person, Photo, Article, Tag, PhotoTag


if __name__ == "__main__":
    database.initialize(SqliteDatabase(":memory:"))
    insertFixtures()

    app = CorkscrewApplication(PHF)
    app.register(Comment, endpoint="/comments")

    app.register(
        Person,
        related={"articles": Article},
        endpoint="/people"
    )

    app.register(
        Photo,
        related={"tags": (Tag, PhotoTag)},
        endpoint="/photos"
    )
    app.register(
        Article,