mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-16 15:20:13 +01:00
Fixup tests
This commit is contained in:
parent
c5dd35de80
commit
081a55d6ac
1 changed files with 19 additions and 14 deletions
|
|
@ -25,10 +25,10 @@ class TodoXmlApiTest < ActionController::IntegrationTest
|
|||
assert_response 401
|
||||
end
|
||||
|
||||
def test_get_tickler_returns_all_deferred_todos
|
||||
number = @user.todos.deferred.count
|
||||
def test_get_tickler_returns_all_deferred_and_pending_todos
|
||||
number = @user.todos.deferred.count + @user.todos.pending.count
|
||||
authenticated_get_xml "/tickler", @user.login, @password, {}
|
||||
assert_tag :tag => "todos", :children => { :count => number, :only => { :tag => "todo" } }
|
||||
assert_tag :tag => "todos", :children => { :count => number }
|
||||
end
|
||||
|
||||
def test_get_tickler_omits_user_id
|
||||
|
|
@ -36,13 +36,13 @@ class TodoXmlApiTest < ActionController::IntegrationTest
|
|||
assert_no_tag :tag => "user_id"
|
||||
end
|
||||
|
||||
def test_create_todo_via_xml_show_from
|
||||
def test_create_todo_with_show_from
|
||||
old_count = @user.todos.count
|
||||
authenticated_post_xml_to_todo_create "
|
||||
<todo>
|
||||
<description>Call Warren Buffet to find out how much he makes per day</description>
|
||||
<project_id>#{projects(:attendrailsconf).id}</project_id>
|
||||
<context_id>#{contexts(:office_otheruser).id}</context_id>
|
||||
<context_id>#{contexts(:office).id}</context_id>
|
||||
<project_id>#{projects(:timemachine).id}</project_id>
|
||||
<show-from type=\"datetime\">#{1.week.from_now.xmlschema}</show-from>
|
||||
</todo>"
|
||||
|
||||
|
|
@ -54,8 +54,8 @@ class TodoXmlApiTest < ActionController::IntegrationTest
|
|||
authenticated_post_xml_to_todo_create "
|
||||
<todo>
|
||||
<description>this will succeed 2</description>
|
||||
<context_id>8</context_id>
|
||||
<project_id>1</project_id>
|
||||
<context_id>#{contexts(:office).id}</context_id>
|
||||
<project_id>#{projects(:timemachine).id}</project_id>
|
||||
<predecessor_dependencies>
|
||||
<predecessor>5</predecessor>
|
||||
<predecessor>6</predecessor>
|
||||
|
|
@ -72,8 +72,8 @@ class TodoXmlApiTest < ActionController::IntegrationTest
|
|||
authenticated_post_xml_to_todo_create "
|
||||
<todo>
|
||||
<description>this will succeed 3</description>
|
||||
<context_id type='integer'>8</context_id>
|
||||
<project_id type='integer'>1</project_id>
|
||||
<context_id>#{contexts(:office).id}</context_id>
|
||||
<project_id>#{projects(:timemachine).id}</project_id>
|
||||
<tags>
|
||||
<tag><name>starred</name></tag>
|
||||
<tag><name>starred2</name></tag>
|
||||
|
|
@ -90,7 +90,7 @@ class TodoXmlApiTest < ActionController::IntegrationTest
|
|||
authenticated_post_xml_to_todo_create "
|
||||
<todo>
|
||||
<description>this will succeed 4</description>
|
||||
<project_id>1</project_id>
|
||||
<project_id>#{projects(:timemachine).id}</project_id>
|
||||
<context>
|
||||
<name>@SomeNewContext</name>
|
||||
</context>
|
||||
|
|
@ -103,11 +103,11 @@ class TodoXmlApiTest < ActionController::IntegrationTest
|
|||
assert_equal todo.context.name, "@SomeNewContext"
|
||||
end
|
||||
|
||||
def test_post_create_todo_with_new_context
|
||||
def test_post_create_todo_with_new_project
|
||||
authenticated_post_xml_to_todo_create "
|
||||
<todo>
|
||||
<description>this will succeed 5</description>
|
||||
<context_id>8</context_id>
|
||||
<context_id>#{contexts(:office).id}</context_id>
|
||||
<project>
|
||||
<name>Make even more money</name>
|
||||
</project>
|
||||
|
|
@ -121,7 +121,12 @@ class TodoXmlApiTest < ActionController::IntegrationTest
|
|||
end
|
||||
|
||||
def test_post_create_todo_with_wrong_project_and_context_id
|
||||
authenticated_post_xml_to_todo_create "<todo><description>this will fail</description><context_id type='integer'>-16</context_id><project_id type='integer'>-11</project_id></todo>"
|
||||
authenticated_post_xml_to_todo_create "
|
||||
<todo>
|
||||
<description>this will fail</description>
|
||||
<context_id type='integer'>-16</context_id>
|
||||
<project_id type='integer'>-11</project_id>
|
||||
</todo>"
|
||||
assert_response 422
|
||||
assert_xml_select 'errors' do
|
||||
assert_select 'error', 2
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue