Esempio n. 1
0
def test_query_properties_named_by_string_on_expando(testbed):
    FlexEmployee(location='SF').put()
    FlexEmployee(location='Amsterdam').put()

    query = snippets.query_properties_named_by_string_on_expando()
    employees = query.fetch()
    assert len(employees) == 1
Esempio n. 2
0
def test_order_query_results_by_property(testbed):
    Article(title='2').put()
    Article(title='1').put()
    FlexEmployee(location=2).put()
    FlexEmployee(location=1).put()
    expando_query, property_query = snippets.order_query_results_by_property(
        'title')

    assert expando_query.fetch()[0].location == 1
    assert property_query.fetch()[0].title == '1'
def test_order_query_results_by_property(testbed):
    Article(title='2').put()
    Article(title='1').put()
    FlexEmployee(location=2).put()
    FlexEmployee(location=1).put()
    expando_query, property_query = snippets.order_query_results_by_property(
        'title')

    if expando_query.fetch()[0].location != 1:
        raise AssertionError
    if property_query.fetch()[0].title != '1':
        raise AssertionError
def order_query_results_by_property(keyword):
    expando_query = FlexEmployee.query().order(ndb.GenericProperty('location'))

    property_query = Article.query().order(Article._properties[keyword])

    return expando_query, property_query
def query_properties_named_by_string_on_expando():
    property_to_query = 'location'
    query = FlexEmployee.query(ndb.GenericProperty(property_to_query) == 'SF')
    return query
Esempio n. 6
0
def order_query_results_by_property(keyword):
    expando_query = FlexEmployee.query().order(ndb.GenericProperty('location'))

    property_query = Article.query().order(Article._properties[keyword])

    return expando_query, property_query
Esempio n. 7
0
def query_properties_named_by_string_on_expando():
    property_to_query = 'location'
    query = FlexEmployee.query(ndb.GenericProperty(property_to_query) == 'SF')
    return query