mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-22 18:20:12 +01:00
Adds functional tests for /projects.xml
This commit is contained in:
parent
e71d23555e
commit
dd0ec129ef
1 changed files with 34 additions and 0 deletions
|
|
@ -222,4 +222,38 @@ class ProjectsControllerTest < ActionController::TestCase
|
|||
assert_equal projects(:moremoney), exposed_projects[2]
|
||||
end
|
||||
|
||||
# XML (REST API)
|
||||
|
||||
def test_xml_content
|
||||
login_as(:admin_user)
|
||||
get :index, { :format => "xml" }
|
||||
assert_equal 'application/xml', @response.content_type
|
||||
# puts @response.body
|
||||
|
||||
assert_xml_select 'projects' do
|
||||
assert_select 'project', 3 do
|
||||
assert_select 'name', /.+/
|
||||
assert_select 'state', 'active'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def test_xml_not_accessible_to_anonymous_user_without_token
|
||||
login_as nil
|
||||
get :index, { :format => "xml" }
|
||||
assert_response 401
|
||||
end
|
||||
|
||||
def test_xml_not_accessible_to_anonymous_user_with_invalid_token
|
||||
login_as nil
|
||||
get :index, { :format => "xml", :token => 'foo' }
|
||||
assert_response 401
|
||||
end
|
||||
|
||||
def test_xml_not_accessible_to_anonymous_user_with_valid_token
|
||||
login_as nil
|
||||
get :index, { :format => "xml", :token => users(:admin_user).token }
|
||||
assert_response 401
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue