diff --git a/zephyr/tests.py b/zephyr/tests.py index f0fb78374e..91f35d8e15 100644 --- a/zephyr/tests.py +++ b/zephyr/tests.py @@ -1005,13 +1005,13 @@ class GetOldMessagesTest(AuthedTestCase): def test_bad_int_params(self): """ - anchor, num_before, num_after, and narrow must all be non-negative + num_before, num_after, and narrow must all be non-negative integers or strings that can be converted to non-negative integers. """ self.login("hamlet@humbughq.com") - other_params = [("narrow", {})] - int_params = ["anchor", "num_before", "num_after"] + other_params = [("narrow", {}), ("anchor", 0)] + int_params = ["num_before", "num_after"] bad_types = (False, "", "-1", -1) for idx, param in enumerate(int_params): diff --git a/zephyr/views.py b/zephyr/views.py index 967e4f46b7..c72f7b96ed 100644 --- a/zephyr/views.py +++ b/zephyr/views.py @@ -585,7 +585,7 @@ def get_public_stream(request, stream, realm): return stream @has_request_variables -def get_old_messages_backend(request, anchor = POST(converter=to_non_negative_int), +def get_old_messages_backend(request, anchor = POST(converter=int), num_before = POST(converter=to_non_negative_int), num_after = POST(converter=to_non_negative_int), narrow = POST('narrow', converter=narrow_parameter, default=None),