예제 #1
0
def test_mysql_update_obj(indata):
    name = indata.name
    class_name = indata.__class__

    mysqldb().add_obj(indata)
    obj = mysqldb().query_obj_first(class_name, {"name": name})

    mysqldb().update_obj(obj, {"code": 1})

    obj = mysqldb().query_obj_first(class_name, {"name": name})
    assert obj.code == "1"
예제 #2
0
def test_mysql_query_None():
    obj = mysqldb().query_obj_first(models.CigmBu, {"name": "asdfasdfasdf"})
    assert obj is None
예제 #3
0
def test_mysql_query_obj(model, attrs):
    assert mysqldb().query_obj(model, attrs) is not None
예제 #4
0
def test_mysql_del_obj(indata):
    mysqldb().del_obj(indata)
예제 #5
0
def test_mysql_insert_objs(indata):
    try:
        mysqldb().add_obj(indata)
    except Exception:
        assert 0