home *** CD-ROM | disk | FTP | other *** search
/ Peanuts NeXT Software Archives / Peanuts-2.iso / Developer / webobjects / extensions / win-nt / NTPerl5-109.exe / ntt / NT / netadmin.manual.test < prev    next >
Encoding:
Text File  |  1996-04-16  |  2.3 KB  |  86 lines

  1. #test for Perl NetAdmin Module Extension.
  2. #Written by Douglas Lankshear for hip communications.
  3.  
  4.  
  5.  
  6. BEGIN{
  7.     @INC = qw( ../lib );
  8.  
  9.         if( Win32::IsWin95() ){
  10.             print"1..1\nok 1\n";
  11.             die" This module does not work on Win95\n";
  12.     }
  13.     ($string, $major, $minor, $build, $id) = NTGetOSVersion;
  14.     if( $major == 3 && $minor < 51){
  15.         print"1..1\nok 1\n";
  16.             die" This module requires NT 3.51 or later\n";
  17.     }
  18.  
  19. };
  20.  
  21. use Win32::NetAdmin;
  22.  
  23. $userName = 'TestUser';
  24. $password = '';
  25. $passwordAge = 0;
  26. $privilege = USER_PRIV_USER;
  27. $homeDir = 'c:\\';
  28. $comment = 'This is a test user';
  29. $flags = UF_SCRIPT;
  30. $scriptpath = 'C:\\';
  31. $groupName = 'TestGroup';
  32. $groupComment = "This is a test group";
  33.  
  34. print "1..16\n";
  35.  
  36. Win32::NetAdmin::UserCreate('', $userName, $password, $passwordAge, $privilege, $homeDir, $comment, $flags, $scriptpath) || print "not ";
  37. print "ok 1\n";
  38.  
  39. Win32::NetAdmin::UserGetAttributes('', $userName, $Getpassword, $GetpasswordAge, $Getprivilege, $GethomeDir, $Getcomment, $Getflags, $Getscriptpath) || print "not ";
  40. print "ok 2\n";
  41.  
  42. ($password eq $Getpassword) || print "not ";
  43. print "ok 3\n";
  44.  
  45. ($passwordAge == $GetpasswordAge) || print "not ";
  46. print "ok 4\n";
  47.  
  48. # privilege is always returned as 0
  49. #($privilege == $Getprivilege) || print "not ";
  50. ($Getprivilege == 0) || print "not ";
  51. print "ok 5\n";
  52.  
  53. ($homeDir eq $GethomeDir) || print "not ";
  54. print "ok 6\n";
  55.  
  56. ($comment eq $Getcomment) || print "not ";
  57. print "ok 7\n";
  58.  
  59. ($flags == ($Getflags&USER_PRIV_MASK)) || print "not ";
  60. print "ok 8\n";
  61.  
  62. ($scriptpath eq $scriptpath) || print "not ";
  63. print "ok 9\n";
  64.  
  65. Win32::NetAdmin::LocalGroupCreate('', $groupName, $groupComment) || print "not ";
  66. print "ok 10\n";
  67.  
  68. Win32::NetAdmin::LocalGroupGetAttributes('', $groupName, $GetgroupComment) || print "not ";
  69. print "ok 11\n";
  70.  
  71. ($groupComment eq $GetgroupComment) || print "not ";
  72. print "ok 12\n";
  73.  
  74. Win32::NetAdmin::LocalGroupAddUsers($domainName, $groupName, $userName) || print "not ";
  75. print "ok 13\n";
  76.  
  77. Win32::NetAdmin::LocalGroupIsMember('', $groupName, $userName) || print "not ";
  78. print "ok 14\n";
  79.  
  80. Win32::NetAdmin::LocalGroupDelete('', $groupName) || print "not ";
  81. print "ok 15\n";
  82.  
  83. Win32::NetAdmin::UserDelete('', $userName) || print "not ";
  84. print "ok 16\n";
  85.  
  86.