# Path: coaster/db.py
# def _set_sqlite_pragma(dbapi_connection, connection_record):
# def _set_postgresql_timezone(dbapi_connection, connection_record):
# 
# Path: tests/test_sqlalchemy_models.py
# class Container(BaseMixin, db.Model):
#     __tablename__ = 'container'
#     name = Column(Unicode(80), nullable=True)
#     title = Column(Unicode(80), nullable=True)
# 
#     content = Column(Unicode(250))
# 
# class NamedDocument(BaseNameMixin, db.Model):
#     __tablename__ = 'named_document'
#     reserved_names = ['new']
#     container_id = Column(Integer, ForeignKey('container.id'))
#     container = relationship(Container)
# 
#     content = Column(Unicode(250))
# 
# class ScopedNamedDocument(BaseScopedNameMixin, db.Model):
#     __tablename__ = 'scoped_named_document'
#     reserved_names = ['new']
#     container_id = Column(Integer, ForeignKey('container.id'))
#     container = relationship(Container)
#     parent = synonym('container')
# 
#     content = Column(Unicode(250))
#     __table_args__ = (UniqueConstraint('container_id', 'name'),)


import unittest
import pytest
from flask import Flask
from werkzeug.routing import BuildError
from coaster.db import db
from .test_sqlalchemy_models import Container, NamedDocument, ScopedNamedDocument
    app = app1

    def setUp(self):
        self.ctx = self.app.test_request_context()
        self.ctx.push()
        db.create_all()
        self.session = db.session

    def tearDown(self):
        self.session.rollback()
        db.drop_all()
        self.ctx.pop()


class TestUrlFor(TestUrlForBase):
    def test_class_has_url_for(self):
        """
        Test that is_url_for declarations on one class are distinct from those on another class.
        """
        assert (
            NamedDocument.url_for_endpoints is not ScopedNamedDocument.url_for_endpoints
        )

    def test_url_for(self):
        """
        Test that is_url_for declarations are saved and used by the url_for method.
        """
        # Make two documents
        doc1 = NamedDocument(name='document1', title="Document 1")
        self.session.add(doc1)

# Path: coaster/db.py
# def _set_sqlite_pragma(dbapi_connection, connection_record):
# def _set_postgresql_timezone(dbapi_connection, connection_record):
# 
# Path: tests/test_sqlalchemy_models.py
# class Container(BaseMixin, db.Model):
#     __tablename__ = 'container'
#     name = Column(Unicode(80), nullable=True)
#     title = Column(Unicode(80), nullable=True)
# 
#     content = Column(Unicode(250))
# 
# class NamedDocument(BaseNameMixin, db.Model):
#     __tablename__ = 'named_document'
#     reserved_names = ['new']
#     container_id = Column(Integer, ForeignKey('container.id'))
#     container = relationship(Container)
# 
#     content = Column(Unicode(250))
# 
# class ScopedNamedDocument(BaseScopedNameMixin, db.Model):
#     __tablename__ = 'scoped_named_document'
#     reserved_names = ['new']
#     container_id = Column(Integer, ForeignKey('container.id'))
#     container = relationship(Container)
#     parent = synonym('container')
# 
#     content = Column(Unicode(250))
#     __table_args__ = (UniqueConstraint('container_id', 'name'),)


# Path: tests/test_url_for.py
import unittest
import pytest
from flask import Flask
from werkzeug.routing import BuildError
from coaster.db import db
from .test_sqlalchemy_models import Container, NamedDocument, ScopedNamedDocument

    app = app1

    def setUp(self):
        self.ctx = self.app.test_request_context()
        self.ctx.push()
        db.create_all()
        self.session = db.session

    def tearDown(self):
        self.session.rollback()
        db.drop_all()
        self.ctx.pop()


class TestUrlFor(TestUrlForBase):
    def test_class_has_url_for(self):
        """
        Test that is_url_for declarations on one class are distinct from those on another class.
        """
        assert (
            NamedDocument.url_for_endpoints is not ScopedNamedDocument.url_for_endpoints
        )

    def test_url_for(self):
        """
        Test that is_url_for declarations are saved and used by the url_for method.
        """
        # Make two documents
        doc1 = NamedDocument(name='document1', title="Document 1")
        self.session.add(doc1)

        c1 = Container()  # Gets an autoincrementing id starting from 1