Sha256: 6d8e5c29b6058f9baa891c42217ba2fd5c4a100f9bbeeb436c24672a05545cc5

Contents?: true

Size: 1.35 KB

Versions: 28

Compression:

Stored size: 1.35 KB

Contents

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

include_fixture_resources

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_equal @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

28 entries across 28 versions & 3 rubygems

Version Path
auser-poolparty-1.3.0 test/lib/poolparty/keypair_test.rb
auser-poolparty-1.3.1 test/lib/poolparty/keypair_test.rb
auser-poolparty-1.3.10 test/lib/poolparty/keypair_test.rb
auser-poolparty-1.3.11 test/lib/poolparty/keypair_test.rb
auser-poolparty-1.3.12 test/lib/poolparty/keypair_test.rb
auser-poolparty-1.3.13 test/lib/poolparty/keypair_test.rb
auser-poolparty-1.3.14 test/lib/poolparty/keypair_test.rb
auser-poolparty-1.3.15 test/lib/poolparty/keypair_test.rb
auser-poolparty-1.3.16 test/lib/poolparty/keypair_test.rb
auser-poolparty-1.3.17 test/lib/poolparty/keypair_test.rb
auser-poolparty-1.3.2 test/lib/poolparty/keypair_test.rb
auser-poolparty-1.3.3 test/lib/poolparty/keypair_test.rb
auser-poolparty-1.3.4 test/lib/poolparty/keypair_test.rb
auser-poolparty-1.3.5 test/lib/poolparty/keypair_test.rb
auser-poolparty-1.3.6 test/lib/poolparty/keypair_test.rb
auser-poolparty-1.3.7 test/lib/poolparty/keypair_test.rb
auser-poolparty-1.3.8 test/lib/poolparty/keypair_test.rb
fairchild-poolparty-1.3.17 test/lib/poolparty/keypair_test.rb
fairchild-poolparty-1.3.5 test/lib/poolparty/keypair_test.rb
poolparty-1.3.15 test/lib/poolparty/keypair_test.rb