def test_grid_search(self): from c2cgeoform.views import grid _add_test_persons() request = testing.DummyRequest() request.matchdict['schema'] = 'tests_persons' request.POST['current'] = '1' request.POST['rowCount'] = '5' request.POST['sort[name]'] = 'asc' request.POST['searchPhrase'] = 'sha' response = grid(request) self.assertEquals(1, response['current']) self.assertEquals(5, response['rowCount']) self.assertEquals(4, response['total']) request.POST['searchPhrase'] = ' Smith ' response = grid(request) self.assertEquals(1, response['total']) request.POST['searchPhrase'] = 'NOT FOUND' response = grid(request) self.assertEquals(0, response['total']) # only text fields tagged with 'admin_list' are searched request.POST['searchPhrase'] = 'Peter' response = grid(request) self.assertEquals(0, response['total'])
def test_grid_search(self): from c2cgeoform.views import grid _add_test_persons() request = self._get_request() request.matchdict['schema'] = 'tests_persons' request.POST['current'] = '1' request.POST['rowCount'] = '5' request.POST['sort[name]'] = 'asc' request.POST['searchPhrase'] = 'sha' response = grid(request) self.assertEquals(1, response['current']) self.assertEquals(5, response['rowCount']) self.assertEquals(4, response['total']) request.POST['searchPhrase'] = ' Smith ' response = grid(request) self.assertEquals(1, response['total']) request.POST['searchPhrase'] = 'NOT FOUND' response = grid(request) self.assertEquals(0, response['total']) # only text fields tagged with 'admin_list' are searched request.POST['searchPhrase'] = 'Peter' response = grid(request) self.assertEquals(0, response['total'])
def test_grid_paging(self): from c2cgeoform.views import grid _add_test_persons() request = testing.DummyRequest() request.matchdict['schema'] = 'tests_persons' request.POST['current'] = '2' request.POST['rowCount'] = '5' request.POST['sort[name]'] = 'asc' response = grid(request) self.assertEquals(2, response['current']) self.assertEquals(5, response['rowCount']) self.assertEquals(22, response['total']) rows = response['rows'] self.assertEquals('Elda', rows[0]['name']) self.assertEquals('Eloise', rows[1]['name']) # invalid page request.POST['current'] = '99' response = grid(request) self.assertEquals(5, response['current'])
def test_grid_paging(self): from c2cgeoform.views import grid _add_test_persons() request = self._get_request() request.matchdict['schema'] = 'tests_persons' request.POST['current'] = '2' request.POST['rowCount'] = '5' request.POST['sort[name]'] = 'asc' response = grid(request) self.assertEquals(2, response['current']) self.assertEquals(5, response['rowCount']) self.assertEquals(22, response['total']) rows = response['rows'] self.assertEquals('Elda', rows[0]['name']) self.assertEquals('Eloise', rows[1]['name']) # invalid page request.POST['current'] = '99' response = grid(request) self.assertEquals(5, response['current'])
def test_grid_sort(self): from c2cgeoform.views import grid _add_test_persons() request = testing.DummyRequest() request.matchdict['schema'] = 'tests_persons' request.POST['current'] = '1' request.POST['rowCount'] = '5' request.POST['sort[name]'] = 'asc' response = grid(request) self.assertEquals(1, response['current']) self.assertEquals(5, response['rowCount']) self.assertEquals(22, response['total']) rows = response['rows'] self.assertEquals('Bess', rows[0]['name']) self.assertEquals('Claudio', rows[1]['name'])
def test_grid(self): from c2cgeoform.views import grid _add_test_persons() request = testing.DummyRequest() request.matchdict['schema'] = 'tests_persons' request.POST['current'] = '1' request.POST['rowCount'] = '5' response = grid(request) self.assertEquals(1, response['current']) self.assertEquals(5, response['rowCount']) self.assertEquals(22, response['total']) rows = response['rows'] self.assertEquals(5, len(rows)) self.assertTrue('_id_' in rows[0]) self.assertEquals('Smith', rows[0]['name'])
def test_grid_sort(self): from c2cgeoform.views import grid _add_test_persons() request = self._get_request() request.matchdict['schema'] = 'tests_persons' request.POST['current'] = '1' request.POST['rowCount'] = '5' request.POST['sort[name]'] = 'asc' response = grid(request) self.assertEquals(1, response['current']) self.assertEquals(5, response['rowCount']) self.assertEquals(22, response['total']) rows = response['rows'] self.assertEquals('Bess', rows[0]['name']) self.assertEquals('Claudio', rows[1]['name'])
def test_grid(self): from c2cgeoform.views import grid _add_test_persons() request = self._get_request() request.matchdict['schema'] = 'tests_persons' request.POST['current'] = '1' request.POST['rowCount'] = '5' response = grid(request) self.assertEquals(1, response['current']) self.assertEquals(5, response['rowCount']) self.assertEquals(22, response['total']) rows = response['rows'] self.assertEquals(5, len(rows)) self.assertTrue('_id_' in rows[0]) self.assertEquals('Smith', rows[0]['name'])