def test_leaderboard(self): lb = leaderboard(2) self.assertTrue(lb) lb = leaderboard(name='unittest') self.assertTrue(lb) lb = leaderboard(name='not_found') self.assertFalse(lb)
def test_leaderboard(self): lb = leaderboard(2) self.assertTrue(lb) lb = leaderboard(name="unittest") self.assertTrue(lb) lb = leaderboard(name="not_found") self.assertFalse(lb)
from leaf import db from leaf.leaderboard import leaderboard from leaf.thing import thing_setup, Thing from leaf.model import Entry # setup db setting # pool_opt sets the db pool min connections and max connections db.setup('localhost', 'test', 'test', 'leaf', pool_opt={'minconn': 3, 'maxconn': 10}) # setup thing_setup, initilaize the thing_setup bind the data-mapper thing_setup() use the leaderboard api lb = leaderboard(leaderboard_id=2) # find leaderboard by leaderboard_id lb = leaderboard(name='name') # load leaderboard by name lb.rank_for_user(12) # rank a user by user id lb.rank_for_users([12, 2]) # rank users by users ################### DB AND Model # ################### # Entry and DB backed entry = Entry(23, 2, 23) Thing('entry').save(entry) entry = Thing('entry').find(2, 23) print entry