def test_conn_str_by_dict_mysql(self):
     self.assertEqual(
         'mysql://*****:*****@127.0.0.1:3306/localdb',
         conn_str_by_dict(self.dbconf_mysql)
     )
 def test_conn_str_by_dict_psql(self):
     self.assertEqual(
         'postgresql+psycopg2://usr:[email protected]:5432/localdb',
         conn_str_by_dict(self.dbconf_psql)
     )
    def test_conn_str_by_dict_requireds(self):
        db_conf = self.dbconf_mysql.copy()
        db_conf.pop('dialect')
        with self.assertRaises(DBAggregatorException) as cm:
            conn_str_by_dict(db_conf)
        self.assertIn('"dialect"', str(cm.exception))


        db_conf = self.dbconf_mysql.copy()
        db_conf['dialect'] = 'sqlite'
        with self.assertRaises(DBAggregatorException) as cm:
            conn_str_by_dict(db_conf)
        self.assertIn('"sqlite"', str(cm.exception))


        db_conf = self.dbconf_mysql.copy()
        db_conf.pop('user')
        with self.assertRaises(DBAggregatorException) as cm:
            conn_str_by_dict(db_conf)
        self.assertIn('"user"', str(cm.exception))


        db_conf = self.dbconf_mysql.copy()
        db_conf.pop('password')
        with self.assertRaises(DBAggregatorException) as cm:
            conn_str_by_dict(db_conf)
        self.assertIn('"password"', str(cm.exception))


        db_conf = self.dbconf_mysql.copy()
        db_conf.pop('host')
        with self.assertRaises(DBAggregatorException) as cm:
            conn_str_by_dict(db_conf)
        self.assertIn('"host"', str(cm.exception))


        db_conf = self.dbconf_mysql.copy()
        db_conf.pop('port')
        with self.assertRaises(DBAggregatorException) as cm:
            conn_str_by_dict(db_conf)
        self.assertIn('"port"', str(cm.exception))


        db_conf = self.dbconf_mysql.copy()
        db_conf.pop('db')
        with self.assertRaises(DBAggregatorException) as cm:
            conn_str_by_dict(db_conf)
        self.assertIn('"db"', str(cm.exception))
예제 #4
0
 def test_conn_str_by_dict_mysql(self):
     self.assertEqual('mysql://*****:*****@127.0.0.1:3306/localdb',
                      conn_str_by_dict(self.dbconf_mysql))
예제 #5
0
 def test_conn_str_by_dict_psql(self):
     self.assertEqual(
         'postgresql+psycopg2://usr:[email protected]:5432/localdb',
         conn_str_by_dict(self.dbconf_psql))
예제 #6
0
    def test_conn_str_by_dict_requireds(self):
        db_conf = self.dbconf_mysql.copy()
        db_conf.pop('dialect')
        with self.assertRaises(DBAggregatorException) as cm:
            conn_str_by_dict(db_conf)
        self.assertIn('"dialect"', str(cm.exception))

        db_conf = self.dbconf_mysql.copy()
        db_conf['dialect'] = 'sqlite'
        with self.assertRaises(DBAggregatorException) as cm:
            conn_str_by_dict(db_conf)
        self.assertIn('"sqlite"', str(cm.exception))

        db_conf = self.dbconf_mysql.copy()
        db_conf.pop('user')
        with self.assertRaises(DBAggregatorException) as cm:
            conn_str_by_dict(db_conf)
        self.assertIn('"user"', str(cm.exception))

        db_conf = self.dbconf_mysql.copy()
        db_conf.pop('password')
        with self.assertRaises(DBAggregatorException) as cm:
            conn_str_by_dict(db_conf)
        self.assertIn('"password"', str(cm.exception))

        db_conf = self.dbconf_mysql.copy()
        db_conf.pop('host')
        with self.assertRaises(DBAggregatorException) as cm:
            conn_str_by_dict(db_conf)
        self.assertIn('"host"', str(cm.exception))

        db_conf = self.dbconf_mysql.copy()
        db_conf.pop('port')
        with self.assertRaises(DBAggregatorException) as cm:
            conn_str_by_dict(db_conf)
        self.assertIn('"port"', str(cm.exception))

        db_conf = self.dbconf_mysql.copy()
        db_conf.pop('db')
        with self.assertRaises(DBAggregatorException) as cm:
            conn_str_by_dict(db_conf)
        self.assertIn('"db"', str(cm.exception))