Sha256: 598b2ab5153af7a582a7db166050c5458c7bad9b6ebed84c1202600459602749

Contents?: true

Size: 1.83 KB

Versions: 107

Compression:

Stored size: 1.83 KB

Contents

require 'spec_helper'

set :os, { :family => nil }

describe get_command(:get_user_uid, 'foo') do
  it { should eq 'id -u foo' }
end

describe get_command(:get_user_gid, 'foo') do
  it { should eq 'id -g foo' }
end

describe get_command(:get_user_home_directory, 'foo') do
  it { should eq "getent passwd foo | awk -F: '{ print $6 }'" }
end

describe get_command(:update_user_home_directory, 'user', 'dir') do
  it { should eq "usermod -d dir user" }
end

describe get_command(:update_user_uid, 'foo', 100) do
  it { should eq 'usermod -u 100 foo' }
end

describe get_command(:update_user_gid, 'foo', 100) do
  it { should eq 'usermod -g 100 foo' }
end

describe get_command(:add_user, 'foo', :home_directory => '/home/foo', :password => '$6$foo/bar', :shell => '/bin/tcsh', :create_home => true) do
  it { should eq 'useradd -d /home/foo -p \$6\$foo/bar -s /bin/tcsh -m foo' }
end

describe get_command(:update_user_encrypted_password, 'foo', 'xxxxxxxx') do
  it { should eq 'echo foo:xxxxxxxx | chpasswd -e' }
end

describe get_command(:get_user_encrypted_password, 'foo') do
  it { should eq "getent shadow foo | awk -F: '{ print $2 }'" }
end

describe get_command(:check_user_has_login_shell, 'foo', '/bin/sh') do
  it { should eq "getent passwd foo | cut -f 7 -d ':' | grep -w -- /bin/sh" }
end

describe get_command(:get_user_minimum_days_between_password_change, 'foo') do
  it { should eq "chage -l foo | grep '^Minimum.*:' | awk -F ': ' '{print $2}'" }
end

describe get_command(:get_user_maximum_days_between_password_change, 'foo') do
  it { should eq "chage -l foo | grep '^Maximum.*:' | awk -F ': ' '{print $2}'" }
end

describe get_command(:get_user_login_shell, 'foo') do
  it { should eq "getent passwd foo | cut -f 7 -d ':'" }
end

describe get_command(:update_user_login_shell, 'foo', '/bin/bash') do
  it { should eq 'usermod -s /bin/bash foo' }
end

Version data entries

107 entries across 107 versions & 3 rubygems

Version Path
specinfra-rb19-2.44.7 spec/command/base/user_spec.rb
specinfra-2.57.2 spec/command/base/user_spec.rb
specinfra-2.57.1 spec/command/base/user_spec.rb
specinfra-cisco-2.41.0 spec/command/base/user_spec.rb
specinfra-2.57.0 spec/command/base/user_spec.rb
specinfra-2.56.1 spec/command/base/user_spec.rb
specinfra-2.56.0 spec/command/base/user_spec.rb
specinfra-2.55.0 spec/command/base/user_spec.rb
specinfra-2.54.2 spec/command/base/user_spec.rb
specinfra-2.54.1 spec/command/base/user_spec.rb
specinfra-2.54.0 spec/command/base/user_spec.rb
specinfra-2.53.1 spec/command/base/user_spec.rb
specinfra-2.53.0 spec/command/base/user_spec.rb
specinfra-2.52.0 spec/command/base/user_spec.rb
specinfra-2.51.2 spec/command/base/user_spec.rb
specinfra-2.51.1 spec/command/base/user_spec.rb
specinfra-2.51.0 spec/command/base/user_spec.rb
specinfra-2.50.4 spec/command/base/user_spec.rb
specinfra-2.50.3 spec/command/base/user_spec.rb
specinfra-2.50.2 spec/command/base/user_spec.rb