summaryrefslogtreecommitdiff
path: root/spec/unit/network/http/api/v2/environments_spec.rb
diff options
context:
space:
mode:
authorStig Sandbeck Mathisen <ssm@debian.org>2014-09-07 10:14:36 +0200
committerStig Sandbeck Mathisen <ssm@debian.org>2014-09-07 10:14:36 +0200
commitd4b83be375ac1dead058e091191ee7c7b7c24c8a (patch)
treedc825687392ae3068de5b764be60c53122d9e02a /spec/unit/network/http/api/v2/environments_spec.rb
parent229cbb976fe0f70f5f30548b83517b415840f9bb (diff)
parent1681684857c6e39d60d87b0b3520d8783977ceff (diff)
downloadpuppet-upstream/3.7.0.tar.gz
Imported Upstream version 3.7.0upstream/3.7.0
Diffstat (limited to 'spec/unit/network/http/api/v2/environments_spec.rb')
-rw-r--r--spec/unit/network/http/api/v2/environments_spec.rb27
1 files changed, 24 insertions, 3 deletions
diff --git a/spec/unit/network/http/api/v2/environments_spec.rb b/spec/unit/network/http/api/v2/environments_spec.rb
index 6c6d7a581..993e55011 100644
--- a/spec/unit/network/http/api/v2/environments_spec.rb
+++ b/spec/unit/network/http/api/v2/environments_spec.rb
@@ -23,20 +23,41 @@ describe Puppet::Network::HTTP::API::V2::Environments do
"production" => {
"settings" => {
"modulepath" => [File.expand_path("/first"), File.expand_path("/second")],
- "manifest" => File.expand_path("/manifests")
+ "manifest" => File.expand_path("/manifests"),
+ "environment_timeout" => 0,
+ "config_version" => ""
}
}
}
})
end
- it "the response conforms to the environments schema" do
+ it "the response conforms to the environments schema for unlimited timeout" do
+ conf_stub = stub 'conf_stub'
+ conf_stub.expects(:environment_timeout).returns(1.0 / 0.0)
environment = Puppet::Node::Environment.create(:production, [])
- handler = Puppet::Network::HTTP::API::V2::Environments.new(Puppet::Environments::Static.new(environment))
+ env_loader = Puppet::Environments::Static.new(environment)
+ env_loader.expects(:get_conf).with(:production).returns(conf_stub)
+ handler = Puppet::Network::HTTP::API::V2::Environments.new(env_loader)
response = Puppet::Network::HTTP::MemoryResponse.new
handler.call(Puppet::Network::HTTP::Request.from_hash(:headers => { 'accept' => 'application/json' }), response)
expect(response.body).to validate_against('api/schemas/environments.json')
end
+
+ it "the response conforms to the environments schema for integer timeout" do
+ conf_stub = stub 'conf_stub'
+ conf_stub.expects(:environment_timeout).returns(1)
+ environment = Puppet::Node::Environment.create(:production, [])
+ env_loader = Puppet::Environments::Static.new(environment)
+ env_loader.expects(:get_conf).with(:production).returns(conf_stub)
+ handler = Puppet::Network::HTTP::API::V2::Environments.new(env_loader)
+ response = Puppet::Network::HTTP::MemoryResponse.new
+
+ handler.call(Puppet::Network::HTTP::Request.from_hash(:headers => { 'accept' => 'application/json' }), response)
+
+ expect(response.body).to validate_against('api/schemas/environments.json')
+ end
+
end