diff --git a/test/integration/context_xml_api_test.rb b/test/integration/context_xml_api_test.rb
index 0c8fdc7a..660a3c97 100644
--- a/test/integration/context_xml_api_test.rb
+++ b/test/integration/context_xml_api_test.rb
@@ -49,6 +49,11 @@ class ContextXmlApiTest < ActionController::IntegrationTest
assert_select 'error', 1, 'Name cannot contain the comma (\',\') character'
end
end
+
+ def test_fails_with_401_if_not_authorized_user
+ authenticated_post_xml_to_context_create @@valid_postdata, 'nobody', 'nohow'
+ assert_response 401
+ end
def test_creates_new_context
assert_difference 'Context.count' do
diff --git a/test/integration/project_xml_api_test.rb b/test/integration/project_xml_api_test.rb
index 2d4586d1..47b6f734 100644
--- a/test/integration/project_xml_api_test.rb
+++ b/test/integration/project_xml_api_test.rb
@@ -43,6 +43,11 @@ class ProjectXmlApiTest < ActionController::IntegrationTest
assert_equal @@project_name, @controller.params[:request][:project][:name]
end
+ def test_fails_with_401_if_not_authorized_user
+ authenticated_post_xml_to_project_create @@valid_postdata, 'nobody', 'nohow'
+ assert_response 401
+ end
+
def test_fails_with_too_long_name
invalid_with_long_name_postdata = "foobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoo arfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoo arfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfo barfoobarfoobarfoobarfoobarfoobarfoobar"
authenticated_post_xml_to_project_create invalid_with_long_name_postdata
diff --git a/test/integration/todo_xml_api_test.rb b/test/integration/todo_xml_api_test.rb
index dc35fa33..c7892490 100644
--- a/test/integration/todo_xml_api_test.rb
+++ b/test/integration/todo_xml_api_test.rb
@@ -2,7 +2,9 @@ require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
require 'todos_controller'
class TodoXmlApiTest < ActionController::IntegrationTest
- fixtures :users, :contexts, :preferences, :todos
+ fixtures :users, :contexts, :preferences, :todos, :projects
+
+ @@valid_postdata = "this will succeed104"
def setup
assert_test_environment_ok
@@ -33,6 +35,20 @@ class TodoXmlApiTest < ActionController::IntegrationTest
authenticated_get_xml "/tickler", @user.login, @password, {}
assert_no_tag :tag => "user_id"
end
+
+ def test_create_todo_via_xml_show_from
+ old_count = @user.todos.count
+ authenticated_post_xml_to_todo_create "
+
+ Call Warren Buffet to find out how much he makes per day
+ #{projects(:attendrailsconf).id}
+ #{contexts(:office_otheruser).id}
+ #{1.week.from_now.xmlschema}
+"
+
+ 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 "this will fail-16-11"
@@ -41,6 +57,11 @@ class TodoXmlApiTest < ActionController::IntegrationTest
assert_select 'error', 2
end
end
+
+ def test_fails_with_401_if_not_authorized_user
+ authenticated_post_xml_to_todo_create '', 'nobody', 'nohow'
+ assert_response 401
+ end
private