mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-16 15:20:13 +01:00
adding tests for creating todos via REST
This commit is contained in:
parent
d73d1efefa
commit
5ff315dac6
1 changed files with 36 additions and 0 deletions
|
|
@ -49,6 +49,42 @@ class TodoXmlApiTest < ActionController::IntegrationTest
|
|||
assert_response :success
|
||||
assert_equal @user.todos.count, old_count + 1
|
||||
end
|
||||
|
||||
def test_post_create_todo_with_dependencies
|
||||
old_count = @user.todos.count
|
||||
authenticated_post_xml_to_todo_create "
|
||||
<todo>
|
||||
<description>this will succeed 2</description>
|
||||
<context_id type='integer'>10</context_id>
|
||||
<project_id type='integer'>4</project_id>
|
||||
<predecessor_dependencies>
|
||||
<predecessor>12</predecessor>
|
||||
</predecessor_dependencies>
|
||||
<successor_dependencies>
|
||||
<successor>12</successor>
|
||||
</successor_dependencies>
|
||||
</todo>"
|
||||
|
||||
assert_response :success
|
||||
assert_equal @user.todos.count, old_count + 1
|
||||
end
|
||||
|
||||
def test_post_create_todo_with_tags
|
||||
old_count = @user.todos.count
|
||||
authenticated_post_xml_to_todo_create "
|
||||
<todo>
|
||||
<description>this will succeed 2</description>
|
||||
<context_id type='integer'>10</context_id>
|
||||
<project_id type='integer'>4</project_id>
|
||||
<tags>
|
||||
<tag><name>starred</name></tag>
|
||||
</tags>
|
||||
</todo>"
|
||||
|
||||
puts @response.body
|
||||
assert_response :success
|
||||
assert_equal @user.todos.count, old_count + 1
|
||||
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>"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue