Sha256: f64ce018f9c0e47c0aaff667e0264519f64e05913d676b856c7e6133f5757b27

Contents?: true

Size: 1.57 KB

Versions: 35

Compression:

Stored size: 1.57 KB

Contents

#!/usr/bin/env rspec
require 'spec_helper'

provider_class = Puppet::Type.type(:sshkey).provider(:parsed)

describe provider_class do
  before do
    @sshkey_class = Puppet::Type.type(:sshkey)
    @provider_class = @sshkey_class.provider(:parsed)
    @key = 'AAAAB3NzaC1yc2EAAAABIwAAAQEAzwHhxXvIrtfIwrudFqc8yQcIfMudrgpnuh1F3AV6d2BrLgu/yQE7W5UyJMUjfj427sQudRwKW45O0Jsnr33F4mUw+GIMlAAmp9g24/OcrTiB8ZUKIjoPy/cO4coxGi8/NECtRzpD/ZUPFh6OEpyOwJPMb7/EC2Az6Otw4StHdXUYw22zHazBcPFnv6zCgPx1hA7QlQDWTu4YcL0WmTYQCtMUb3FUqrcFtzGDD0ytosgwSd+JyN5vj5UwIABjnNOHPZ62EY1OFixnfqX/+dUwrFSs5tPgBF/KkC6R7tmbUfnBON6RrGEmu+ajOTOLy23qUZB4CQ53V7nyAWhzqSK+hw=='
  end

  it "should parse the name from the first field" do
    @provider_class.parse_line('test ssh-rsa '+@key)[:name].should == "test"
  end

  it "should parse the first component of the first field as the name" do
    @provider_class.parse_line('test,alias ssh-rsa '+@key)[:name].should == "test"
  end

  it "should parse host_aliases from the remaining components of the first field" do
    @provider_class.parse_line('test,alias ssh-rsa '+@key)[:host_aliases].should == ["alias"]
  end

  it "should parse multiple host_aliases" do
    @provider_class.parse_line('test,alias1,alias2,alias3 ssh-rsa '+@key)[:host_aliases].should == ["alias1","alias2","alias3"]
  end

  it "should not drop an empty host_alias" do
    @provider_class.parse_line('test,alias, ssh-rsa '+@key)[:host_aliases].should == ["alias",""]
  end

  it "should recognise when there are no host aliases" do
    @provider_class.parse_line('test ssh-rsa '+@key)[:host_aliases].should == []
  end

end

Version data entries

35 entries across 35 versions & 3 rubygems

Version Path
puppet-2.7.26 spec/unit/provider/sshkey/parsed_spec.rb
puppet-2.7.25 spec/unit/provider/sshkey/parsed_spec.rb
puppet-2.7.24 spec/unit/provider/sshkey/parsed_spec.rb
puppet-2.7.23 spec/unit/provider/sshkey/parsed_spec.rb
puppet-2.7.22 spec/unit/provider/sshkey/parsed_spec.rb
puppet-2.7.21 spec/unit/provider/sshkey/parsed_spec.rb
puppet-2.7.20 spec/unit/provider/sshkey/parsed_spec.rb
puppet-2.7.20.rc1 spec/unit/provider/sshkey/parsed_spec.rb
librarian-puppet-0.9.4 vendor/gems/ruby/1.8/gems/puppet-2.7.18/spec/unit/provider/sshkey/parsed_spec.rb
puppet-2.7.19 spec/unit/provider/sshkey/parsed_spec.rb
supply_drop-0.11.0 examples/vendored-puppet/vendor/puppet-2.7.8/spec/unit/provider/sshkey/parsed_spec.rb
librarian-puppet-0.9.3 vendor/gems/ruby/1.8/gems/puppet-2.7.18/spec/unit/provider/sshkey/parsed_spec.rb
supply_drop-0.10.2 examples/vendored-puppet/vendor/puppet-2.7.8/spec/unit/provider/sshkey/parsed_spec.rb
puppet-2.7.18 spec/unit/provider/sshkey/parsed_spec.rb
supply_drop-0.10.1 examples/vendored-puppet/vendor/puppet-2.7.8/spec/unit/provider/sshkey/parsed_spec.rb
supply_drop-0.10.0 examples/vendored-puppet/vendor/puppet-2.7.8/spec/unit/provider/sshkey/parsed_spec.rb
puppet-2.7.17 spec/unit/provider/sshkey/parsed_spec.rb
puppet-2.7.16 spec/unit/provider/sshkey/parsed_spec.rb
puppet-2.7.14 spec/unit/provider/sshkey/parsed_spec.rb
puppet-2.7.13 spec/unit/provider/sshkey/parsed_spec.rb