Created
March 22, 2011 23:50
-
-
Save lak/882358 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env ruby | |
| require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper.rb') | |
| require 'puppet/ssl/certificate_status' | |
| describe Puppet::SSL::CertificateStatus do | |
| before do | |
| @status = Puppet::SSL::CertificateStatus.new("mysigner") | |
| Puppet::SSL::CertificateAuthority.stubs(:ca?).returns true | |
| end | |
| it "should have a name" do | |
| @status.name.should == "mysigner" | |
| end | |
| it "should accept a 'fingerprint' attribute" do | |
| @status.fingerprint = "something" | |
| @status.fingerprint.should == "something" | |
| end | |
| it "should accept a 'message' attribute" do | |
| @status.message = "something" | |
| @status.message.should == "something" | |
| end | |
| it "should accept a 'state' attribute" do | |
| @status.state = "invalid" | |
| @status.state.should == "invalid" | |
| end | |
| it "should fail unless the state is a valid listed state" do | |
| lambda { @status.state = "bad" }.should raise_error(ArgumentError, /certificate state/) | |
| end | |
| %w{requested signed invoked invalid}.each do |state| | |
| it "should accept '#{state}' as a valid state" do | |
| @status.state = state | |
| @status.state.should == state | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment