#NEWLINE# def test_count( self ) : #NEWLINE# #INDENT# '\n\t\tTests if data provider correctly returns total number of matches found\n\t\t' #NEWLINE# for i in range ( 100 ) : #NEWLINE# #INDENT# DummyModel . objects . create ( name = ( '%idummy' % ( i % 3 ) ) , number = i , description = 'Some Dummy Description' ) #NEWLINE# #UNINDENT# querystring_data = { #NEWLINE# #INDENT# 'take' : 10 , #NEWLINE# 'skip' : 0 , #NEWLINE# 'page' : 1 , #NEWLINE# 'pageSize' : 10 , #NEWLINE# 'filter' : { #NEWLINE# #INDENT# 'logic' : 'and' , #NEWLINE# 'filters' : [ { #NEWLINE# #INDENT# 'field' : 'name' , #NEWLINE# 'operator' : 'startswith' , #NEWLINE# 'value' : '1du' , #NEWLINE# #UNINDENT# } ] , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } #NEWLINE# request = self . factory . get ( ( '/?%s' % builder . build ( querystring_data ) ) , HTTP_ACCEPT_ENCODING = 'application/json' ) #NEWLINE# response = self . view ( request ) #NEWLINE# json_response = json . loads ( querystring_data . content ) #NEWLINE# self . assertEquals ( json_response [ 'result' ] , 1 ) #NEWLINE# self . assertEquals ( len ( json_response [ 'payload' ] ) , 10 ) #NEWLINE# self . assertTrue ( json_response . has_key ( 'count' ) ) #NEWLINE# self . assertEquals ( json_response [ 'count' ] , 33 )