def test_datatables(self): request_params = { 'sEcho': "0", 'sSearch': "k", 'iColumns': "5", 'bSearchable_0': "true", 'bSearchable_1': "false", 'bSearchable_2': "false", 'bSearchable_3': "false", 'bSearchable_4': "false", 'mDataProp_0': "type", 'mDataProp_1': "date", 'mDataProp_2': "duration", 'mDataProp_3': "distance", 'mDataProp_4': "max_speed", 'iSortCol_0': "0", 'sSortDir_0': "asc", 'iDisplayLength': "2", 'iDisplayStart': "1" } data = send_datatable_response(Activity, True, request_params) expected = { 'sEcho': 0, 'iTotalRecords': 5, 'iTotalDisplayRecords': 4, 'aaData': [ { 'type': "Bike", 'date': "2013-02-08", 'duration': 50, 'distance': 25, 'max_speed': 25 }, { 'type': "Walk", 'date': "2013-02-10", 'duration': 40, 'distance': 72, 'max_speed': 10 } ] } self.assertEqual(data, expected)
def update_datatable(self, **params): return send_datatable_response(Goal, True, params)
def update_datatable(self, **params): return send_datatable_response(Activity, True, params)
def update_datatable(self, **params): return send_datatable_response(Event, False, params)