Sha256: 4d5e9fcd1a4bbbf657001fc41af6a930a6578d1fcef269d4fc8b99a1a77b313a

Contents?: true

Size: 1.32 KB

Versions: 15

Compression:

Stored size: 1.32 KB

Contents

require "#{File.dirname(__FILE__)}/../../test_helper"

Keypair.searchable_paths << fixtures_dir/"keys"

class KeypairTest < Test::Unit::TestCase
  context "Base" do
    setup do
      @keypair = Keypair.new(fixtures_dir/"keys"/"test_key")
    end
    
    should "set the file given as the file for the keypair" do
      assert_equal @keypair.filepath, fixtures_dir/"keys"/"test_key"
      assert_equal @keypair.full_filepath, File.expand_path(fixtures_dir/"keys"/"test_key")
      assert_match @keypair.to_s, File.expand_path(fixtures_dir/"keys"/"test_key")
    end
    
    should "have the content of the file available" do
      assert_equal @keypair.content, open(fixtures_dir/"keys"/"test_key").read
    end
    
    should "be able to generate the public key from the private" # do
    #       # assert_equal @keypair.public_key, "#{open(fixtures_dir/"test_pub_key").read}"
    #     end
    
    should "have the basename of the keypair" do
      assert_equal @keypair.basename, "test_key"
      assert_equal @keypair.filename, "test_key"      
    end
    
    should "be valid if it's 600 permissions" do
      assert @keypair.valid?
    end
    
    should "be invalid if the file permissions are executable" do
      assert_raises StandardError do
        Keypair.new(fixtures_dir/"bad_perms_test_key").valid?
      end
    end
  end  
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
poolparty-1.6.4 test/lib/poolparty/keypair_test.rb
poolparty-1.6.3 test/lib/poolparty/keypair_test.rb
poolparty-1.6.2 test/lib/poolparty/keypair_test.rb
poolparty-1.6.1 test/lib/poolparty/keypair_test.rb
poolparty-1.6.0 test/lib/poolparty/keypair_test.rb
poolparty-1.5.0 test/lib/poolparty/keypair_test.rb
poolparty-1.4.8 test/lib/poolparty/keypair_test.rb
poolparty-1.4.7 test/lib/poolparty/keypair_test.rb
poolparty-1.4.6 test/lib/poolparty/keypair_test.rb
poolparty-1.4.5 test/lib/poolparty/keypair_test.rb
poolparty-1.4.4 test/lib/poolparty/keypair_test.rb
poolparty-1.4.3 test/lib/poolparty/keypair_test.rb
poolparty-1.4.2 test/lib/poolparty/keypair_test.rb
poolparty-1.4.1 test/lib/poolparty/keypair_test.rb
poolparty-1.4.0 test/lib/poolparty/keypair_test.rb