diff options
| author | Daniel Pittman <daniel@puppetlabs.com> | 2011-05-12 14:31:01 -0700 |
|---|---|---|
| committer | Daniel Pittman <daniel@puppetlabs.com> | 2011-05-12 14:31:01 -0700 |
| commit | 82fb02ce27c95d8326335a8d52a9ab7e676fe8d3 (patch) | |
| tree | 6706dc7afa05bf4bbffb2ab7e616717fb6af0c86 /spec/unit/node | |
| parent | 7f9c9e1089c4bc36d52fcdd9751de559c658bf8d (diff) | |
| parent | 704623cb95aacb0544609620994dc36f61a4b463 (diff) | |
Merge branch 'next'
Diffstat (limited to 'spec/unit/node')
| -rwxr-xr-x | spec/unit/node/facts_spec.rb | 33 |
1 files changed, 5 insertions, 28 deletions
diff --git a/spec/unit/node/facts_spec.rb b/spec/unit/node/facts_spec.rb index 07f5f7e1b..efaa76e12 100755 --- a/spec/unit/node/facts_spec.rb +++ b/spec/unit/node/facts_spec.rb @@ -110,11 +110,7 @@ describe Puppet::Node::Facts, "when indirecting" do end it "should accept properly formatted pson" do - facts = Puppet::Node::Facts.new("foo") - facts.values = {"a" => "1", "b" => "2", "c" => "3"} - facts.expiration = Time.now - #pson = %Q({"document_type": "Puppet::Node::Facts", "data: {"name": "foo", "expiration": "#{@expiration}", "timestamp": "#{@timestamp}", "values": {"a": "1", "b": "2", "c": "3"}}}) - pson = %Q({"data": {"name":"foo", "expiration":"#{@expiration}", "timestamp": "#{@timestamp}", "values":{"a":"1","b":"2","c":"3"}}, "document_type":"Puppet::Node::Facts"}) + pson = %Q({"name": "foo", "expiration": "#{@expiration}", "timestamp": "#{@timestamp}", "values": {"a": "1", "b": "2", "c": "3"}}) format = Puppet::Network::FormatHandler.format('pson') facts = format.intern(Puppet::Node::Facts,pson) facts.name.should == 'foo' @@ -127,29 +123,10 @@ describe Puppet::Node::Facts, "when indirecting" do facts = Puppet::Node::Facts.new("foo", {'a' => 1, 'b' => 2, 'c' => 3}) facts.expiration = @expiration result = PSON.parse(facts.to_pson) - result.name.should == facts.name - result.values.should == facts.values - result.timestamp.should == facts.timestamp - result.expiration.should == facts.expiration - result.type.should == Puppet::Node::Facts - end - - it "should not include nil values" do - facts = Puppet::Node::Facts.new("foo", {'a' => 1, 'b' => 2, 'c' => 3}) - - # XXX:LAK For some reason this is resurrection the full instance, instead - # of just returning the hash. This code works, but I can't figure out what's - # going on. - newfacts = PSON.parse(facts.to_pson) - newfacts.expiration.should be_nil - end - - it "should be able to handle nil values" do - pson = %Q({"name": "foo", "values": {"a": "1", "b": "2", "c": "3"}}) - format = Puppet::Network::FormatHandler.format('pson') - facts = format.intern(Puppet::Node::Facts,pson) - facts.name.should == 'foo' - facts.expiration.should be_nil + result['name'].should == facts.name + result['values'].should == facts.values.reject { |key, value| key.to_s =~ /_/ } + result['timestamp'].should == facts.timestamp.to_s + result['expiration'].should == facts.expiration.to_s end end end |
