diff options
| author | Max Martin <max@puppetlabs.com> | 2011-02-18 15:24:52 -0800 |
|---|---|---|
| committer | Max Martin <max@puppetlabs.com> | 2011-02-18 15:24:52 -0800 |
| commit | d1955e5c92bc5e2eaf25b28b5102b6f7d10922bb (patch) | |
| tree | 7e4421582c3080611a0184033cff0cade2508d80 | |
| parent | 12fd75a7c575ea181f065b6aaffdcb65417aeb35 (diff) | |
| parent | d1f1858ea52d3089fd2088994e80d6f49d7e0347 (diff) | |
| download | puppet-d1955e5c92bc5e2eaf25b28b5102b6f7d10922bb.tar.gz puppet-d1955e5c92bc5e2eaf25b28b5102b6f7d10922bb.tar.xz puppet-d1955e5c92bc5e2eaf25b28b5102b6f7d10922bb.zip | |
Merge branch 'ticket/2.6.next/6376-_search-support' into 2.6.next
| -rw-r--r-- | lib/puppet/network/http/api/v1.rb | 4 | ||||
| -rw-r--r-- | spec/unit/network/http/api/v1_spec.rb | 12 |
2 files changed, 14 insertions, 2 deletions
diff --git a/lib/puppet/network/http/api/v1.rb b/lib/puppet/network/http/api/v1.rb index 0a04a465f..9e51aae36 100644 --- a/lib/puppet/network/http/api/v1.rb +++ b/lib/puppet/network/http/api/v1.rb @@ -63,9 +63,9 @@ module Puppet::Network::HTTP::API::V1 return :singular if indirection == "status" return :plural if indirection == "inventory" - result = (indirection =~ /s$/) ? :plural : :singular + result = (indirection =~ /s$|_search$/) ? :plural : :singular - indirection.sub!(/s$/, '') if result + indirection.sub!(/s$|_search$|es$/, '') result end diff --git a/spec/unit/network/http/api/v1_spec.rb b/spec/unit/network/http/api/v1_spec.rb index d47fc8d81..e7348312b 100644 --- a/spec/unit/network/http/api/v1_spec.rb +++ b/spec/unit/network/http/api/v1_spec.rb @@ -88,6 +88,18 @@ describe Puppet::Network::HTTP::API::V1 do @tester.uri2indirection("GET", "/env/inventory/search", {}).method.should == :search end + it "should choose 'search' as the indirection method if the http method is a GET and the indirection name is facts_search" do + @tester.uri2indirection("GET", "/env/facts_search/bar", {}).method.should == :search + end + + it "should change indirection name to 'facts' if the http method is a GET and the indirection name is facts_search" do + @tester.uri2indirection("GET", "/env/facts_search/bar", {}).indirection_name.should == :facts + end + + it "should change indirection name to 'status' if the http method is a GEt and the indirection name is statuses" do + @tester.uri2indirection("GET", "/env/statuses/bar", {}).indirection_name.should == :status + end + it "should choose 'delete' as the indirection method if the http method is a DELETE and the indirection name is singular" do @tester.uri2indirection("DELETE", "/env/foo/bar", {}).method.should == :destroy end |
