示例#1
0
 def test_reset_query(self):
     r = RESTQuery()
     r.required_query_parameter_is("active", "EQUALS", "true")
     r.include_fields_in_response("name", "short_description")
     r._reset_query()  # Called at the end of execute_query in practice
     assert r._query_is_empty()
     assert not r.desired_response_fields
示例#2
0
 def test_add_fields_to_desired_response_fields(self):
     r = RESTQuery()
     r.include_fields_in_response("number")
     r.include_fields_in_response("state", "location.name")
     assert len(r.desired_response_fields) == 3
     assert ("number" in r.desired_response_fields
             and "state" in r.desired_response_fields
             and "location.name" in r.desired_response_fields)