def setUp(self):
        dbwrap.connect(connect='sqlite:///:memory:')
        dbwrap.Base.metadata.create_all()

        db = dbwrap.session()
        model.create_sample_data()
        self.db = db
    def setUp(self):
        dbwrap.connect(connect='sqlite:///:memory:')
        dbwrap.Base.metadata.create_all()

        db = dbwrap.session()
        model.create_sample_data()
        self.db = db

        from webtest import TestApp
        from bottle import TEMPLATE_PATH
        TEMPLATE_PATH.insert(0, '../views')
        self.app = website.build_application()
        self.harness = TestApp(self.app)
示例#3
0
def create_sample_data():
    from bottledbwrap import dbwrap

    dbwrap.connect()
    dbwrap.Base.metadata.create_all()
    db = dbwrap.session()

    sean = User(
            full_name='Sean Reifschneider', name='sean',
            email_address='*****@*****.**')
    db.add(sean)
    evi = User(
            full_name='Evi Nemeth', name='evi',
            email_address='*****@*****.**')
    db.add(evi)
    dmr = User(
            full_name='Dennis Ritchie', name='dmr',
            email_address='*****@*****.**')
    db.add(dmr)

    dmr = User(
            full_name='Peichao Wang', name='pwang',
            email_address='*****@*****.**')
    db.add(dmr)

    db.commit()


    q = TrueFalseQuestion(descr=u'幻想与一般的创造想象区别在于,幻想中所创造的形象总是体现着个人的愿望,并指向未来。',
        note=u'对')

    db.add(q)

    q = ChoiceQuestion(multi=1, descr=u'教育目的就其表述和内容而言具有( )特征。',
        choice_list=u'抽象性@理想性@可操作性@终极性', note=u'ABD')
    db.add(q)

    q = ChoiceQuestion(multi=1, descr=u'下列关于复式教学叙述正确的是( )。',
        choice_list=u'复式教学就是对两个以上年级的学生进行教学的一种教学组织形式@复式教学适用于学生多、教室少的情况下教学@复式教学课堂教师的教学和学生的自学或做作业同时进行@复式教学情景下的学生的基本技能和自学能力相对较弱',
        note=u'ABC')
    db.add(q)

    db.commit()
示例#4
0
def create_sample_data():
    from bottledbwrap import dbwrap

    dbwrap.connect()
    dbwrap.Base.metadata.create_all()
    db = dbwrap.session()

    sean = User(full_name='Sean Reifschneider',
                name='sean',
                email_address='*****@*****.**')
    db.add(sean)
    evi = User(full_name='Evi Nemeth',
               name='evi',
               email_address='*****@*****.**')
    db.add(evi)
    dmr = User(full_name='Dennis Ritchie',
               name='dmr',
               email_address='*****@*****.**')
    db.add(dmr)

    db.commit()
def create_sample_data():
    from bottledbwrap import dbwrap

    dbwrap.connect()
    dbwrap.Base.metadata.create_all()
    db = dbwrap.session()

    sean = User(
            full_name='Sean Reifschneider', name='sean',
            email_address='*****@*****.**')
    db.add(sean)
    evi = User(
            full_name='Evi Nemeth', name='evi',
            email_address='*****@*****.**')
    db.add(evi)
    dmr = User(
            full_name='Dennis Ritchie', name='dmr',
            email_address='*****@*****.**')
    db.add(dmr)

    db.commit()
示例#6
0
def initdb():
    '''Populate an empty database with the schema'''
    from bottledbwrap import dbwrap

    dbwrap.connect()
    dbwrap.Base.metadata.create_all()
def initdb():
    '''Populate an empty database with the schema'''
    from bottledbwrap import dbwrap

    dbwrap.connect()
    dbwrap.Base.metadata.create_all()