Beispiel #1
0
def test_record_buildUpdateClauses_simple():
    r = Record()
    data = {'Name':'Foo'}
    fieldList = ['Name']
    clauses = r.buildUpdateClauses(data, fieldList)
    assert clauses['FieldNames'] == ['Name = %s']
    assert clauses['FieldData'] == ['Foo']
Beispiel #2
0
def test_record_buildUpdateClauses_two():
    r = Record()
    data = {'Foo':'one','Bar':'two'}
    fieldList = ['Foo','Bar']
    clauses = r.buildUpdateClauses(data, fieldList)
    assert clauses['FieldNames'] == ['Bar = %s','Foo = %s']
    assert clauses['FieldData'] == ['two','one']
Beispiel #3
0
def test_record_buildUpdateClauses_DOB():
    r = Record()
    r.connectDB()
    data = {'Foo':'one','DOB':(1996,4,13,19,30,0,0,0,0)}
    fieldList = ['Foo','DOB']
    clauses = r.buildUpdateClauses(data, fieldList)
    assert clauses['FieldNames'] == ['DOB = %s','Foo = %s']
    assert clauses['FieldData'] == ['1996-04-13 19:30:00','one']
Beispiel #4
0
def test_record_buildUpdateClauses_empty():
    r = Record()
    data = []
    fieldList = []
    clauses = r.buildUpdateClauses(data, fieldList)
    assert clauses == {
        'FieldData': [],
        'FieldNames': []
    }