Exemplo n.º 1
0
 def setUp(self):
     app.config['TESTING'] = True
     app.config['SERVER_NAME'] = "localhost:5000"
     app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///' + os.path.join(basedir, 'test.db')
     self.app_context = app.app_context()
     self.app_context.push()
     self.app = app.test_client()
     Database_queries.createTestData()
Exemplo n.º 2
0
    def testFindMatch(self):
        peter_user = models.User.query.filter(User.username==u'Peter').one()
        assert isinstance(peter_user, User)

        # Found already existed match
        m = Database_queries.findMatchForUser(peter_user)
        assert isinstance(m, Match)
        print 'founded existed match: %s' % m.__repr__()

        # Create new match
        m1 = Database_queries.findMatchForUser(peter_user)
        db.session.add(m1)
        db.session.commit()
        print 'created new match: %s' % m1.__repr__()
        app.logger.debug('testFindMatch - OK')