summaryrefslogtreecommitdiffstats
path: root/spec/unit/network/http/api
diff options
context:
space:
mode:
authorMatt Robinson <matt@puppetlabs.com>2010-10-28 14:49:37 -0700
committerMatt Robinson <matt@puppetlabs.com>2010-10-28 15:09:15 -0700
commit45a9a97285d99db524d5330c236352b29e5884ed (patch)
tree65d227ec46a7259a2a06221889cb48d1698dff3a /spec/unit/network/http/api
parente559b48d51c53c4a345353de1e196634c7430195 (diff)
downloadpuppet-45a9a97285d99db524d5330c236352b29e5884ed.tar.gz
puppet-45a9a97285d99db524d5330c236352b29e5884ed.tar.xz
puppet-45a9a97285d99db524d5330c236352b29e5884ed.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.
Diffstat (limited to 'spec/unit/network/http/api')
-rw-r--r--spec/unit/network/http/api/v1_spec.rb12
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 c593242c0..8d507046f 100644
--- a/spec/unit/network/http/api/v1_spec.rb
+++ b/spec/unit/network/http/api/v1_spec.rb
@@ -72,6 +72,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