add parameter to REST api for todos to limit result to active todos. Fixes #1388

This commit is contained in:
Reinier Balt 2014-05-16 15:33:45 +02:00
parent 4cde8ce78b
commit 595806be87
3 changed files with 27 additions and 2 deletions

View file

@ -17,7 +17,7 @@ class TodoXmlApiTest < ActionDispatch::IntegrationTest
get '/tickler.xml', {}, {}
assert_response 401
get "/tickler.xml", {}, {'HTT_AUTHORIZATION' => "Basic " + Base64.encode64("wrong:wrong"),'ACCEPT' => 'application/xml'}
get "/tickler.xml", {}, {'HTTP_AUTHORIZATION' => "Basic " + Base64.encode64("wrong:wrong"),'ACCEPT' => 'application/xml'}
assert_response 401
end
@ -32,6 +32,19 @@ class TodoXmlApiTest < ActionDispatch::IntegrationTest
assert_no_tag :tag => "user_id"
end
def test_get_index_with_only_active_todos
authenticated_get_xml "/todos.xml", @user.login, @password, {}
assert_response 200
all_todo_count = assigns['xml_todos']
authenticated_get_xml "/todos.xml?limit_to_active_todos=1", @user.login, @password, {}
assert_response 200
active_todo_count = assigns['xml_todos']
assert all_todo_count != active_todo_count, "active should be less than all todos"
end
def test_create_todo_with_show_from
old_count = @user.todos.count
authenticated_post_xml_to_todo_create "