summaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rwxr-xr-xspec/unit/provider/ssh_authorized_key/parsed.rb21
-rwxr-xr-xspec/unit/type/ssh_authorized_key.rb41
2 files changed, 21 insertions, 41 deletions
diff --git a/spec/unit/provider/ssh_authorized_key/parsed.rb b/spec/unit/provider/ssh_authorized_key/parsed.rb
index c35ddc513..16efc5b58 100755
--- a/spec/unit/provider/ssh_authorized_key/parsed.rb
+++ b/spec/unit/provider/ssh_authorized_key/parsed.rb
@@ -71,4 +71,25 @@ describe provider_class do
genkey(key).should == "from=\"192.168.1.1\",no-pty,no-X11-forwarding ssh-rsa AAAAfsfddsjldjgksdflgkjsfdlgkj root@localhost\n"
end
+
+ it "should prefetch ~user/.ssh/authorized_keys when user is given" do
+ key = Puppet::Type.type(:ssh_authorized_key).create(
+ :name => "Test",
+ :key => "AA",
+ :type => "rsa",
+ :ensure => :present,
+ :user => "root")
+ prov = @provider.new key
+
+ prov.prefetch
+ prov.target.should == File.expand_path("~root/.ssh/authorized_keys")
+ end
+
+ it "should create destination dir" do
+ # No idea how to test the flush method
+ end
+
+ it "should set correct default permissions" do
+ # No idea how to test the flush method
+ end
end
diff --git a/spec/unit/type/ssh_authorized_key.rb b/spec/unit/type/ssh_authorized_key.rb
index 0b41af40a..e21478479 100755
--- a/spec/unit/type/ssh_authorized_key.rb
+++ b/spec/unit/type/ssh_authorized_key.rb
@@ -77,47 +77,6 @@ describe ssh_authorized_key do
@class.attrtype(:target).should == :property
end
- it "should autorequire parent directories when user is given" do
- @catalog.add_resource @class.create(
- :name => "Test",
- :key => "AAA",
- :type => "ssh-rsa",
- :ensure => :present,
- :user => "root")
- @catalog.apply
-
- target = File.expand_path("~root/.ssh")
- @catalog.resource(:file, target).should be_an_instance_of(Puppet::Type.type(:file))
- end
-
- it "should set target when user is given" do
- @catalog.add_resource @class.create(
- :name => "Test",
- :key => "AAA",
- :type => "ssh-rsa",
- :ensure => :present,
- :user => "root")
- @catalog.apply
-
- target = File.expand_path("~root/.ssh/authorized_keys")
- @catalog.resource(:file, target).should be_an_instance_of(Puppet::Type.type(:file))
- end
-
-
- it "should autorequire parent directories when target is given" do
- target = "/tmp/home/foo/bar/.ssh/authorized_keys"
-
- @catalog.add_resource @class.create(
- :name => "Test",
- :key => "AAA",
- :type => "ssh-rsa",
- :ensure => :present,
- :target => target)
- @catalog.apply
-
- @catalog.resource(:file, target).should be_an_instance_of(Puppet::Type.type(:file))
- end
-
it "should raise an error when neither user nor target is given" do
proc do
@class.create(