home *** CD-ROM | disk | FTP | other *** search
/ Tutto per Internet / Internet.iso / soft95 / Html / PerlW32 / netadmin.ntt < prev    next >
Encoding:
Text File  |  1996-01-31  |  2.1 KB  |  81 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.  
  14. };
  15.  
  16. use Win32::NetAdmin;
  17.  
  18. $userName = 'TestUser';
  19. $password = '';
  20. $passwordAge = 0;
  21. $privilege = USER_PRIV_USER;
  22. $homeDir = 'c:\\';
  23. $comment = 'This is a test user';
  24. $flags = UF_SCRIPT;
  25. $scriptpath = 'C:\\';
  26. $groupName = 'TestGroup';
  27. $groupComment = "This is a test group";
  28.  
  29. print "1..16\n";
  30.  
  31. Win32::NetAdmin::UserCreate('', $userName, $password, $passwordAge, $privilege, $homeDir, $comment, $flags, $scriptpath) || print "not ";
  32. print "ok 1\n";
  33.  
  34. Win32::NetAdmin::UserGetAttributes('', $userName, $Getpassword, $GetpasswordAge, $Getprivilege, $GethomeDir, $Getcomment, $Getflags, $Getscriptpath) || print "not ";
  35. print "ok 2\n";
  36.  
  37. ($password eq $Getpassword) || print "not ";
  38. print "ok 3\n";
  39.  
  40. ($passwordAge == $GetpasswordAge) || print "not ";
  41. print "ok 4\n";
  42.  
  43. # privilege is always returned as 0
  44. #($privilege == $Getprivilege) || print "not ";
  45. ($Getprivilege == 0) || print "not ";
  46. print "ok 5\n";
  47.  
  48. ($homeDir eq $GethomeDir) || print "not ";
  49. print "ok 6\n";
  50.  
  51. ($comment eq $Getcomment) || print "not ";
  52. print "ok 7\n";
  53.  
  54. ($flags == ($Getflags&USER_PRIV_MASK)) || print "not ";
  55. print "ok 8\n";
  56.  
  57. ($scriptpath eq $scriptpath) || print "not ";
  58. print "ok 9\n";
  59.  
  60. Win32::NetAdmin::LocalGroupCreate('', $groupName, $groupComment) || print "not ";
  61. print "ok 10\n";
  62.  
  63. Win32::NetAdmin::LocalGroupGetAttributes('', $groupName, $GetgroupComment) || print "not ";
  64. print "ok 11\n";
  65.  
  66. ($groupComment eq $GetgroupComment) || print "not ";
  67. print "ok 12\n";
  68.  
  69. Win32::NetAdmin::LocalGroupAddUsers($domainName, $groupName, $userName) || print "not ";
  70. print "ok 13\n";
  71.  
  72. Win32::NetAdmin::LocalGroupIsMember('', $groupName, $userName) || print "not ";
  73. print "ok 14\n";
  74.  
  75. Win32::NetAdmin::LocalGroupDelete('', $groupName) || print "not ";
  76. print "ok 15\n";
  77.  
  78. Win32::NetAdmin::UserDelete('', $userName) || print "not ";
  79. print "ok 16\n";
  80.  
  81.