Esempio n. 1
0
class LoadMyFixtures(FixturesMixin):
    fixtures = ['tests/fixtures.json']
    app = app
    db = db
    db.create_all()

    def __init__(self):
        import pdb
        pdb.set_trace()
        pass
Esempio n. 2
0
class MyTest(unittest.TestCase, FixturesMixin):
    # engine_default = create_engine(DB_CONN_URI_DEFAULT)
    fixtures = ['tests/fixtures.json']
    app = app
    db = db
    db.create_all()

    def test_programs(self):
        programs = Programs.query.all()
        assert len(programs) == Programs.query.count() == 4

    def test_sections(self):
        sections = Sections.query.all()
        assert len(sections) == Sections.query.count() == 26

    def test_activities(self):
        activities = Activities.query.all()
        assert len(activities) == Activities.query.count() == 26
Esempio n. 3
0
    # the Questions object can now be iterated over. (also allows us to convert to a dict() )
    def __iter__(self):
        yield 'id', self.id
        yield 'title', self.title
        yield 'text', self.text
        yield 'register_date', str(self.register_date)
        yield 'engineer', self.engineer
        yield 'closed', self.closed
        yield 'user_id', self.user_id
        yield 'ups', self.ups
        yield 'downs', self.downs


# Initializes the database
db.create_all()


# Returns True if user exists
def questionExists(id):
    return Question.query.filter_by(id=id).first() is not None


# Returns True if user is created
def createQuestion(title, text, engineer, user_id):
    try:
        # Create the new Question
        question = Question(title=title,
                            text=text,
                            engineer=engineer,
                            closed=False,
Esempio n. 4
0
def create():
	db.create_all()

	return
Esempio n. 5
0
#!/usr/bin/env python
# coding: utf-8
from config import SQLALCHEMY_DATABASE_URI
from index import db


if __name__ == "__main__":
    db.create_all()