Sha256: adc4faa9761c387725a7119a6eae656a5a128a2b6e6802d86c81c2da9405376e

Contents?: true

Size: 1.98 KB

Versions: 1

Compression:

Stored size: 1.98 KB

Contents

###############################################################################
# tc_unix.rb
#
# Test suite for the Unix version of sys-admin. This test should be run
# via the 'rake test' task.
###############################################################################
require 'test/unit'
require 'sys/admin'
include Sys

class TC_Sys_Admin_Unix < Test::Unit::TestCase
   def setup
      @user    = "nobody"
      @userid  = 0
      @group   = "sys"
      @groupid = 3
   end

   def test_version
      assert_equal("1.4.1", Admin::VERSION)
   end

   def test_get_login
      assert_respond_to(Admin, :get_login)
      assert_nothing_raised{ Admin.get_login }
      assert_kind_of(String, Admin.get_login)
   end

   def test_get_user
      assert_respond_to(Admin, :get_user)
      assert_nothing_raised{ Admin.get_user(@user) }
      assert_nothing_raised{ Admin.get_user(@userid) }
      assert_kind_of(User, Admin.get_user(@user))
      assert_kind_of(User, Admin.get_user(@userid))
      assert_raises(AdminError){ Admin.get_user("foofoo") }
   end

   def test_users
      assert_respond_to(Admin, :users)
      assert_nothing_raised{ Admin.users }
      assert_nothing_raised{ Admin.users{ |g| } }
      assert_kind_of(Array, Admin.users)
      assert_kind_of(User, Admin.users.first)
   end

   def test_get_group
      assert_respond_to(Admin, :get_group)
      assert_nothing_raised{ Admin.get_group(@group) }
      assert_nothing_raised{ Admin.get_group(@groupid) }
      assert_kind_of(Group, Admin.get_group(@group))
      assert_kind_of(Group, Admin.get_group(@groupid))
      assert_raises(AdminError){ Admin.get_group("foofoo") }
   end

   def test_groups
      assert_respond_to(Admin, :groups)
      assert_nothing_raised{ Admin.groups }
      assert_nothing_raised{ Admin.groups{ |g| } }
      assert_kind_of(Array, Admin.groups)
      assert_kind_of(Group, Admin.groups.first)
   end

   def teardown
      @user    = nil
      @userid  = nil
      @group   = nil
      @groupid = nil
   end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sys-admin-1.4.1 test/tc_unix.rb