Sha256: 2371364045f75af7091cbe8645a9157ebdde8adeb29c41035241416a55cdcb8f

Contents?: true

Size: 1.66 KB

Versions: 143

Compression:

Stored size: 1.66 KB

Contents

require 'common'

class Protocol::V04::TestName < Net::SFTP::TestCase
  def setup
    @save_tz   = ENV['TZ']
    ENV['TZ']  = 'UTC'

    @directory = Net::SFTP::Protocol::V04::Name.new("test", Net::SFTP::Protocol::V04::Attributes.new(:type => 2, :mtime => 1205293237, :owner => "jamis", :group => "users", :size => 1024, :permissions => 0755))
    @link      = Net::SFTP::Protocol::V04::Name.new("test", Net::SFTP::Protocol::V04::Attributes.new(:type => 3, :mtime => 1205293237, :owner => "jamis", :group => "users", :size => 32, :permissions => 0755))
    @file      = Net::SFTP::Protocol::V04::Name.new("test", Net::SFTP::Protocol::V04::Attributes.new(:type => 1, :mtime => 1205293237, :owner => "jamis", :group => "users", :size => 10240, :permissions => 0755))
  end

  def teardown
    if @save_tz
      ENV['TZ'] = @save_tz
    else
      ENV.delete('TZ')
    end
  end

  def test_directory?
    assert @directory.directory?
    assert !@link.directory?
    assert !@file.directory?
  end

  def test_symlink?
    assert !@directory.symlink?
    assert @link.symlink?
    assert !@file.symlink?
  end

  def test_file?
    assert !@directory.file?
    assert !@link.file?
    assert @file.file?
  end

  def test_longname_for_directory_should_format_as_directory
    assert_equal "drwxr-xr-x jamis    users        1024 Mar 12 03:40 test",
      @directory.longname
  end

  def test_longname_for_symlink_should_format_as_symlink
    assert_equal "lrwxr-xr-x jamis    users          32 Mar 12 03:40 test",
      @link.longname
  end

  def test_longname_for_file_should_format_as_file
    assert_equal "-rwxr-xr-x jamis    users       10240 Mar 12 03:40 test",
      @file.longname
  end
end

Version data entries

143 entries across 106 versions & 9 rubygems

Version Path
vagrant-unbundled-2.1.1.0 vendor/bundle/ruby/2.5.0/gems/net-sftp-2.1.2/test/protocol/04/test_name.rb
vagrant-unbundled-2.0.4.0 vendor/bundle/ruby/2.5.0/gems/net-sftp-2.1.2/test/protocol/04/test_name.rb
vagrant-unbundled-2.0.3.0 vendor/bundle/ruby/2.5.0/gems/net-sftp-2.1.2/test/protocol/04/test_name.rb
vagrant-unbundled-2.0.2.0 vendor/bundle/ruby/2.5.0/gems/net-sftp-2.1.2/test/protocol/04/test_name.rb
vagrant-unbundled-2.0.2.0 vendor/bundle/ruby/2.4.0/gems/net-sftp-2.1.2/test/protocol/04/test_name.rb
vagrant-unbundled-2.0.1.0 vendor/bundle/ruby/2.4.0/gems/net-sftp-2.1.2/test/protocol/04/test_name.rb
vagrant-unbundled-2.0.0.1 vendor/bundle/ruby/2.4.0/gems/net-sftp-2.1.2/test/protocol/04/test_name.rb
vagrant-unbundled-1.9.8.1 vendor/bundle/ruby/2.4.0/gems/net-sftp-2.1.2/test/protocol/04/test_name.rb
vagrant-unbundled-1.9.7.1 vendor/bundle/ruby/2.4.0/gems/net-sftp-2.1.2/test/protocol/04/test_name.rb
vagrant-unbundled-1.9.5.1 vendor/bundle/ruby/2.4.0/gems/net-sftp-2.1.2/test/protocol/04/test_name.rb
vagrant-unbundled-1.9.1.1 vendor/bundle/ruby/2.4.0/gems/net-sftp-2.1.2/test/protocol/04/test_name.rb
vagrant-compose-yaml-0.1.3 vendor/bundle/ruby/2.2.0/gems/net-sftp-2.1.2/test/protocol/04/test_name.rb
vagrant-compose-yaml-0.1.2 vendor/bundle/ruby/2.2.0/gems/net-sftp-2.1.2/test/protocol/04/test_name.rb
vagrant-compose-yaml-0.1.1 vendor/bundle/ruby/2.2.0/gems/net-sftp-2.1.2/test/protocol/04/test_name.rb
vagrant-compose-yaml-0.1.0 vendor/bundle/ruby/2.2.0/gems/net-sftp-2.1.2/test/protocol/04/test_name.rb
vagrant-unbundled-1.8.5.2 vendor/bundle/ruby/2.3.0/gems/net-sftp-2.1.2/test/protocol/04/test_name.rb
vagrant-unbundled-1.8.5.1 vendor/bundle/ruby/2.3.0/gems/net-sftp-2.1.2/test/protocol/04/test_name.rb
vagrant-unbundled-1.8.4.2 vendor/bundle/ruby/2.3.0/gems/net-sftp-2.1.2/test/protocol/04/test_name.rb
vagrant-unbundled-1.8.4.1 vendor/bundle/ruby/2.3.0/gems/net-sftp-2.1.2/test/protocol/04/test_name.rb
vagrant-unbundled-1.8.1.1 vendor/bundle/ruby/2.3.0/gems/net-sftp-2.1.2/test/protocol/04/test_name.rb