REST API for creating/updating wiki pages (#7082).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10717 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2012-10-25 20:38:29 +00:00
parent 9e31308720
commit eff874b29a
5 changed files with 173 additions and 48 deletions

View File

@@ -33,16 +33,6 @@ class RoutingWikiTest < ActionController::IntegrationTest
{ :controller => 'wiki', :action => 'show', :project_id => '567',
:id => 'lalala', :format => 'pdf' }
)
assert_routing(
{ :method => 'get', :path => "/projects/567/wiki/lalala.xml" },
{ :controller => 'wiki', :action => 'show', :project_id => '567',
:id => 'lalala', :format => 'xml' }
)
assert_routing(
{ :method => 'get', :path => "/projects/567/wiki/lalala.json" },
{ :controller => 'wiki', :action => 'show', :project_id => '567',
:id => 'lalala', :format => 'json' }
)
assert_routing(
{ :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/diff" },
{ :controller => 'wiki', :action => 'diff', :project_id => '1',
@@ -53,16 +43,6 @@ class RoutingWikiTest < ActionController::IntegrationTest
{ :controller => 'wiki', :action => 'show', :project_id => '1',
:id => 'CookBook_documentation', :version => '2' }
)
assert_routing(
{ :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/2.xml" },
{ :controller => 'wiki', :action => 'show', :project_id => '1',
:id => 'CookBook_documentation', :version => '2', :format => 'xml' }
)
assert_routing(
{ :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/2.json" },
{ :controller => 'wiki', :action => 'show', :project_id => '1',
:id => 'CookBook_documentation', :version => '2', :format => 'json' }
)
assert_routing(
{ :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/2/diff" },
{ :controller => 'wiki', :action => 'diff', :project_id => '1',
@@ -92,14 +72,6 @@ class RoutingWikiTest < ActionController::IntegrationTest
{ :method => 'get', :path => "/projects/567/wiki/index" },
{ :controller => 'wiki', :action => 'index', :project_id => '567' }
)
assert_routing(
{ :method => 'get', :path => "/projects/567/wiki/index.xml" },
{ :controller => 'wiki', :action => 'index', :project_id => '567', :format => 'xml' }
)
assert_routing(
{ :method => 'get', :path => "/projects/567/wiki/index.json" },
{ :controller => 'wiki', :action => 'index', :project_id => '567', :format => 'json' }
)
end
def test_wiki_resources
@@ -156,4 +128,45 @@ class RoutingWikiTest < ActionController::IntegrationTest
:id => 'ladida', :version => '3' }
)
end
def test_api
assert_routing(
{ :method => 'get', :path => "/projects/567/wiki/my_page.xml" },
{ :controller => 'wiki', :action => 'show', :project_id => '567',
:id => 'my_page', :format => 'xml' }
)
assert_routing(
{ :method => 'get', :path => "/projects/567/wiki/my_page.json" },
{ :controller => 'wiki', :action => 'show', :project_id => '567',
:id => 'my_page', :format => 'json' }
)
assert_routing(
{ :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/2.xml" },
{ :controller => 'wiki', :action => 'show', :project_id => '1',
:id => 'CookBook_documentation', :version => '2', :format => 'xml' }
)
assert_routing(
{ :method => 'get', :path => "/projects/1/wiki/CookBook_documentation/2.json" },
{ :controller => 'wiki', :action => 'show', :project_id => '1',
:id => 'CookBook_documentation', :version => '2', :format => 'json' }
)
assert_routing(
{ :method => 'get', :path => "/projects/567/wiki/index.xml" },
{ :controller => 'wiki', :action => 'index', :project_id => '567', :format => 'xml' }
)
assert_routing(
{ :method => 'get', :path => "/projects/567/wiki/index.json" },
{ :controller => 'wiki', :action => 'index', :project_id => '567', :format => 'json' }
)
assert_routing(
{ :method => 'put', :path => "/projects/567/wiki/my_page.xml" },
{ :controller => 'wiki', :action => 'update', :project_id => '567',
:id => 'my_page', :format => 'xml' }
)
assert_routing(
{ :method => 'put', :path => "/projects/567/wiki/my_page.json" },
{ :controller => 'wiki', :action => 'update', :project_id => '567',
:id => 'my_page', :format => 'json' }
)
end
end