예제 #1
0
class TestMaster(unittest.TestCase):
    """
    Tests for class Master, Jez I'm getting tired of writting
    this shit
    """
    def setUp(self):
        """
        var setups
        """

        self.master_config = '../../docs/config/my_master.json'
        self.slave_config = '../../docs/config/my_slave.json'
        self.base = None
        self.conn = None
        self.mast = None

        self.base = BaseDB()
        self.base.load_config(self.master_config)
        self.conn, db, t = self.base.connect_server()
        self.mast = Master(self.conn)

    def test_master(self):
        self.assertGreater(len(self.mast.list_libraries()), 0)

    def test_add_job(self):
        self.mast.clear_jobs()
        self.assertEqual(self.mast.count_jobs(), 0)
        jobs = [{
            "symbol": "AMD",
            'time_start': 'N/A',
            'time_end': 'N/A',
            'interval': '15min',
            'field': 'price'
        }]
        self.mast.add_jobs(jobs)
        self.assertEqual(self.mast.count_jobs(), 1)
예제 #2
0
 def test_master(self):
     ins = BaseDB()
     ins.load_config(self.config)
     conn, db, t = ins.connect_server()
     mast = Master(conn)
     self.assertGreater(len(mast.list_libraries()), 0)