Esempio n. 1
0
from leaf.thing import thing_setup
from leaf.leaderboard import leaderboard


import unittest
import data

db.setup("localhost", "test", "test", "leaf", pool_opt={"minconn": 3, "maxconn": 10})
thing_setup()


class LeaderboardTest(unittest.TestCase):
    def setUp(self):
        data.up(lid=2)

    def tearDown(self):
        data.down(lid=2)

    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)


if __name__ == "__main__":
    log.setdebug(False)
    unittest.main()
Esempio n. 2
0
db.setup('localhost',
         'test',
         'test',
         'leaf',
         pool_opt={
             'minconn': 3,
             'maxconn': 10
         })
thing_setup()


class LeaderboardTest(unittest.TestCase):
    def setUp(self):
        data.up(lid=2)

    def tearDown(self):
        data.down(lid=2)

    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)


if __name__ == '__main__':
    log.setdebug(False)
    unittest.main()
Esempio n. 3
0
from nagi import db
import log
from nagi.thing import Thing, thing_setup
from nagi.cron import Cron
import unittest

db.setup('localhost',
         'test',
         'test',
         'nagi',
         pool_opt={
             'minconn': 3,
             'maxconn': 10
         })
thing_setup()


class CronTest(unittest.TestCase):
    def test_add_and_cancel_job(self):
        cron = Cron()
        cron.add_job('cron_job', 'every 5')
        self.assertEqual(Thing('job').find('cron_job').name, 'cron_job')
        cron.cancel_job('cron_job')
        self.assertEqual(Thing('job').find('cron_job'), None)


if __name__ == '__main__':
    log.setdebug(True)
    unittest.main()
Esempio n. 4
0
from nagi import db
import log
from nagi.thing import Thing, thing_setup
from nagi.cron import Cron
import unittest

db.setup('localhost', 'test', 'test', 'nagi', pool_opt={'minconn': 3, 'maxconn': 10})
thing_setup()


class CronTest(unittest.TestCase):

    def test_add_and_cancel_job(self):
        cron = Cron()
        cron.add_job('cron_job', 'every 5')
        self.assertEqual(Thing('job').find('cron_job').name, 'cron_job')
        cron.cancel_job('cron_job')
        self.assertEqual(Thing('job').find('cron_job'), None)

if __name__ == '__main__':
    log.setdebug(True)
    unittest.main()