mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-16 23:30:12 +01:00
fix #857 and further refactoring for better done view
This commit is contained in:
parent
c61238933c
commit
35fe362b93
10 changed files with 76 additions and 30 deletions
37
test/integration/todo_xml_api_test.rb
Normal file
37
test/integration/todo_xml_api_test.rb
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
|
||||
require 'todos_controller'
|
||||
|
||||
class TodoXmlApiTest < ActionController::IntegrationTest
|
||||
fixtures :users, :contexts, :preferences, :todos
|
||||
|
||||
def setup
|
||||
assert_test_environment_ok
|
||||
@user = users(:other_user)
|
||||
@password = 'sesame'
|
||||
end
|
||||
|
||||
def test_get_tickler_succeeds
|
||||
authenticated_get_xml "/tickler", @user.login, @password, {}
|
||||
assert_response 200
|
||||
end
|
||||
|
||||
def test_get_tickler_needs_authentication
|
||||
get '/tickler.xml', {}, {}
|
||||
assert_response 401
|
||||
|
||||
get "/tickler", {}, {'AUTHORIZATION' => "Basic " + Base64.encode64("wrong:wrong"),'ACCEPT' => 'application/xml'}
|
||||
assert_response 401
|
||||
end
|
||||
|
||||
def test_get_tickler_returns_all_deferred_todos
|
||||
number = @user.todos.deferred.count
|
||||
authenticated_get_xml "/tickler", @user.login, @password, {}
|
||||
assert_tag :tag => "todos", :children => { :count => number, :only => { :tag => "todo" } }
|
||||
end
|
||||
|
||||
def test_get_tickler_omits_user_id
|
||||
authenticated_get_xml "/tickler", @user.login, @password, {}
|
||||
assert_no_tag :tag => "user_id"
|
||||
end
|
||||
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue