diff options
| author | Paul Berry <paul@puppetlabs.com> | 2011-02-17 14:59:59 -0800 |
|---|---|---|
| committer | Paul Berry <paul@puppetlabs.com> | 2011-02-17 14:59:59 -0800 |
| commit | 23fc4db954c22bce2c6cc8996d5fafb175e2b747 (patch) | |
| tree | fef367b2b6a94148b0207ad13acd53e42d49bea1 /spec/unit/network/http/api | |
| parent | ab27da7967e1e145d5fbc130e5fbcec6795ca775 (diff) | |
| download | puppet-23fc4db954c22bce2c6cc8996d5fafb175e2b747.tar.gz puppet-23fc4db954c22bce2c6cc8996d5fafb175e2b747.tar.xz puppet-23fc4db954c22bce2c6cc8996d5fafb175e2b747.zip | |
(#5132) Provide a query REST interface for inventory
This REST interface returns a list of nodes that match a fact query.
Fact queries can use (in)equality testing as a string comparison, and >,
<, >=, <= numerical comparisons. Multiple tests can be done as AND
comparisons, not OR.
The fact queries need to be prefixed by facts, and the comparisons other
than equality are specified with a .comparison_type after the fact name.
This will be better explained in the REST documentation on the website.
Searches that don't match anything now return empty array instead of a
404 error.
Conflicts:
spec/spec_helper.rb
Diffstat (limited to 'spec/unit/network/http/api')
| -rw-r--r-- | spec/unit/network/http/api/v1_spec.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/unit/network/http/api/v1_spec.rb b/spec/unit/network/http/api/v1_spec.rb index 23a291cf3..d47fc8d81 100644 --- a/spec/unit/network/http/api/v1_spec.rb +++ b/spec/unit/network/http/api/v1_spec.rb @@ -76,6 +76,18 @@ describe Puppet::Network::HTTP::API::V1 do @tester.uri2indirection("GET", "/env/foos/bar", {}).method.should == :search end + it "should choose 'find' as the indirection method if the http method is a GET and the indirection name is facts" do + @tester.uri2indirection("GET", "/env/facts/bar", {}).method.should == :find + end + + it "should choose 'save' as the indirection method if the http method is a PUT and the indirection name is facts" do + @tester.uri2indirection("PUT", "/env/facts/bar", {}).method.should == :save + end + + it "should choose 'search' as the indirection method if the http method is a GET and the indirection name is inventory" do + @tester.uri2indirection("GET", "/env/inventory/search", {}).method.should == :search + 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 |
