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