예제 #1
0
def test_initializer_1():
    rql = Query({
        'product.id': 'PRD-123123123',
        'ordering': ['test1', 'test2'],
        'limit': 10,
        'offset': 4,
        'order_by': 'property'
    })
    assert rql.compile() == '?eq(product.id,PRD-123123123)&ordering(test1,test2)&limit=10'\
                            '&order_by=property&offset=4'
예제 #2
0
def test_offset():
    rql = Query().offset(10)
    assert rql.compile() == '?offset=10'
예제 #3
0
def test_limit():
    rql = Query().limit(10)
    assert rql.compile() == '?limit=10'
예제 #4
0
def test_lesser_equal():
    rql = Query().lesser_equal('property', 'value')
    assert rql.compile() == '?le(property,value)'
예제 #5
0
def test_empty_initializer():
    rql = Query()
    assert rql.compile() == ''
예제 #6
0
def test_greater_equal():
    rql = Query().greater_equal('property', 'value')
    assert rql.compile() == '?ge(property,value)'
예제 #7
0
def test_order_by():
    rql = Query().order_by('date')
    assert rql.compile() == '?order_by=date'
예제 #8
0
def test_ilike():
    rql = Query().ilike('product.id', 'PR-')
    assert rql.compile() == '?ilike(product.id,PR-)'
예제 #9
0
def test_select():
    rql = Query().select(['attribute'])
    assert rql.compile() == '?select(attribute)'
예제 #10
0
def test_out():
    rql = Query().out('product.id', ['PR-', 'CN-'])
    assert rql.compile() == '?out(product.id,(PR-,CN-))'
예제 #11
0
def test_in():
    rql = Query().in_('key', ['value1', 'value2'])
    assert rql.compile() == '?in(key,(value1,value2))'
예제 #12
0
def test_not_equal():
    rql = Query().not_equal('property', 'value')
    assert rql.compile() == '?ne(property,value)'
예제 #13
0
def test_equal():
    rql = Query().equal('key', 'value')
    assert rql.compile() == '?eq(key,value)'
예제 #14
0
def test_initializer_2():
    rql = Query({'product.id': ['PRD-123123123', 'PRD-123123123']})
    assert rql.compile() == '?in(product.id,(PRD-123123123,PRD-123123123))'
예제 #15
0
def test_ordering():
    rql = Query().ordering(['property1', 'property2'])
    assert rql.compile() == '?ordering(property1,property2)'