'num_before, num_after, and narrow must all be non-negative
integers or strings that can be converted to non-negative integers.'

def test_bad_int_params(self):

    self.login(self.example_email('hamlet'))
    other_params = [('narrow', {}), ('anchor', 0)]
    int_params = ['num_before', 'num_after']
    bad_types = (False, '', '-1', (-1))
    for (idx, param) in enumerate(int_params):
        for type in bad_types:
            post_params = dict(((other_params + [(param, type)]) + [(other_param, 0) for other_param in (int_params[:idx] + int_params[(idx + 1):])]))
            result = self.client_get('/json/messages', post_params)
            self.assert_json_error(result, ("Bad    value    for    '%s':    %s" % (param, type)))
