s3-param: Add "server role" as global parameter
[samba.git] / wintest / wintest.py
index 10bc5629553cb57297561009a79b1c8d99d13062..d5728a883b5a7a9d2548b21175cacfdeeea510a4 100644 (file)
@@ -13,7 +13,7 @@ class wintest():
         self.vars = {}
         self.list_mode = False
         self.vms = None
-        os.putenv('PYTHONUNBUFFERED', '1')
+        os.environ['PYTHONUNBUFFERED'] = '1'
         self.parser = optparse.OptionParser("wintest")
 
     def check_prerequesites(self):
@@ -90,7 +90,10 @@ class wintest():
     def set_vms(self, vms):
         '''set a list of VMs to test'''
         if vms is not None:
-            self.vms = vms.split(',')
+            self.vms = []
+            for vm in vms.split(','):
+                vm = vm.upper()
+                self.vms.append(vm)
 
     def skip(self, step):
         '''return True if we should skip a step'''
@@ -139,7 +142,7 @@ class wintest():
 
     def putenv(self, key, value):
         '''putenv with substitution'''
-        os.putenv(key, self.substitute(value))
+        os.environ[key] = self.substitute(value)
 
     def chdir(self, dir):
         '''chdir with substitution'''
@@ -445,7 +448,7 @@ options {
         self.rndc_cmd("flush")
 
     def restart_bind(self, kerberos_support=False, include=None):
-        self.configure_bind(keberos_support=kerberos_support, include=include)
+        self.configure_bind(kerberos_support=kerberos_support, include=include)
         self.stop_bind()
         self.start_bind()
 
@@ -560,7 +563,7 @@ options {
             return True
 
     def set_noexpire(self, child, username):
-        '''Ensure this user's password does not expire'''
+        """Ensure this user's password does not expire"""
         child.sendline('wmic useraccount where name="%s" set PasswordExpires=FALSE' % username)
         child.expect("update successful")
         child.expect("C:")
@@ -568,13 +571,13 @@ options {
     def run_tlntadmn(self, child):
         '''remove the annoying telnet restrictions'''
         child.sendline('tlntadmn config maxconn=1024')
-        child.expect("The settings were successfully updated")
+        child.expect(["The settings were successfully updated", "Access is denied"])
         child.expect("C:")
 
     def disable_firewall(self, child):
         '''remove the annoying firewall'''
         child.sendline('netsh advfirewall set allprofiles state off')
-        i = child.expect(["Ok", "The following command was not found: advfirewall set allprofiles state off"])
+        i = child.expect(["Ok", "The following command was not found: advfirewall set allprofiles state off", "The requested operation requires elevation"])
         child.expect("C:")
         if i == 1:
             child.sendline('netsh firewall set opmode mode = DISABLE profile = ALL')
@@ -582,7 +585,7 @@ options {
             if i != 0:
                 self.info("Firewall disable failed - ignoring")
             child.expect("C:")
+
     def set_dns(self, child):
         child.sendline('netsh interface ip set dns "${WIN_NIC}" static ${INTERFACE_IP} primary')
         i = child.expect(['C:', pexpect.EOF, pexpect.TIMEOUT], timeout=5)
@@ -842,6 +845,13 @@ RebootOnCompletion=No
         self.cmd_contains("bin/smbclient --version", ["${SAMBA_VERSION}"])
         self.retry_cmd('bin/smbclient -L ${WIN_HOSTNAME} -U%s%%%s %s' % (username, password, args), ["IPC"])
 
+    def test_net_use(self, vm, domain, username, password):
+        self.setwinvars(vm)
+        self.info('Testing net use against Samba3 member')
+        child = self.open_telnet("${WIN_HOSTNAME}", "%s\\%s" % (domain, username), password)
+        child.sendline("net use t: \\\\${HOSTNAME}.${LCREALM}\\test")
+        child.expect("The command completed successfully")
+
 
     def setup(self, testname, subdir):
         '''setup for main tests, parsing command line'''