Beispiel #1
0
def test_sysinfo_manage():
    db_util = DBUtil()

    #create
    demo_system = SystemInfo(sys_name='oa333', db_type=DatabaseType.oracle, db_ip='127.0.0.1',
                         db_port='1521', db_name='db', db_table_name='accounts', db_column_username='******',
                         db_column_password='******', db_password_encrypt_algorithm=EncryptAlgorithmType.md5)
    db_util.add_system(demo_system)
    for i in db_util.get_all_system():
        print i

    #update
    demo_system.db_type = DatabaseType.mysql
    demo_system.db_port = '3306'

    #request
    idd = demo_system.id
    print '____________________%d' % idd
    s =  db_util.get_system_by_id(idd)
    print s
    print '__ __ __ __ __ __ __ ___ ___%d' % idd

    #delete
    db_util.del_system(s)
    s =  db_util.get_system_by_id(idd)
    print s