mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-22 06:29:23 +01:00
auto-t: update testClientNonInteractive to use TestContext
This makes any iwctl output hidden unless enabled via the verbose option.
This commit is contained in:
parent
4c6173ee89
commit
03ff410dff
@ -8,6 +8,7 @@ import iwd
|
|||||||
from iwd import IWD
|
from iwd import IWD
|
||||||
import testutil
|
import testutil
|
||||||
import subprocess
|
import subprocess
|
||||||
|
from config import ctx
|
||||||
|
|
||||||
class Test(unittest.TestCase):
|
class Test(unittest.TestCase):
|
||||||
|
|
||||||
@ -34,11 +35,10 @@ class Test(unittest.TestCase):
|
|||||||
|
|
||||||
# Use --dontaks cmd-line option
|
# Use --dontaks cmd-line option
|
||||||
with self.assertRaises(subprocess.CalledProcessError):
|
with self.assertRaises(subprocess.CalledProcessError):
|
||||||
subprocess.check_call(['iwctl', '-d', 'station',
|
ctx.start_process(['iwctl', 'd', 'station', device.name, 'connect', ssid], check=True)
|
||||||
device.name, 'connect', ssid])
|
|
||||||
|
|
||||||
subprocess.check_call(['iwctl', '-P', 'passphrase',
|
ctx.start_process(['iwctl', '-P', 'passphrase', 'station', device.name, 'connect', ssid],
|
||||||
'station', device.name, 'connect', ssid])
|
check=True)
|
||||||
|
|
||||||
self.check_connection_success(ssid)
|
self.check_connection_success(ssid)
|
||||||
|
|
||||||
@ -47,9 +47,8 @@ class Test(unittest.TestCase):
|
|||||||
|
|
||||||
device = self.wd.list_devices(1)[0]
|
device = self.wd.list_devices(1)[0]
|
||||||
|
|
||||||
subprocess.check_call(['iwctl', '-u', 'user', '-p', 'password',
|
ctx.start_process(['iwctl', '-u', 'user', '-p', 'password', 'station', \
|
||||||
'station', device.name, 'connect', ssid])
|
device.name, 'connect', ssid], check=True)
|
||||||
|
|
||||||
self.check_connection_success(ssid)
|
self.check_connection_success(ssid)
|
||||||
|
|
||||||
def test_connection_with_password(self):
|
def test_connection_with_password(self):
|
||||||
@ -57,8 +56,8 @@ class Test(unittest.TestCase):
|
|||||||
|
|
||||||
device = self.wd.list_devices(1)[0]
|
device = self.wd.list_devices(1)[0]
|
||||||
|
|
||||||
subprocess.check_call(['iwctl', '-p', 'password',
|
ctx.start_process(['iwctl', '-p', 'password', 'station', device.name, 'connect', ssid],
|
||||||
'station', device.name, 'connect', ssid])
|
check=True)
|
||||||
|
|
||||||
self.check_connection_success(ssid)
|
self.check_connection_success(ssid)
|
||||||
|
|
||||||
@ -68,8 +67,8 @@ class Test(unittest.TestCase):
|
|||||||
device = self.wd.list_devices(1)[0]
|
device = self.wd.list_devices(1)[0]
|
||||||
|
|
||||||
with self.assertRaises(subprocess.CalledProcessError):
|
with self.assertRaises(subprocess.CalledProcessError):
|
||||||
subprocess.check_call(['iwctl', '-P', 'incorrect_passphrase',
|
ctx.start_process(['iwctl', '-P', 'incorrect_passphrase', 'station', device.name, \
|
||||||
'station', device.name, 'connect', ssid])
|
'connect', ssid], check=True)
|
||||||
|
|
||||||
def test_invalid_command_line_option(self):
|
def test_invalid_command_line_option(self):
|
||||||
ssid = 'ssidPassphrase'
|
ssid = 'ssidPassphrase'
|
||||||
@ -77,14 +76,13 @@ class Test(unittest.TestCase):
|
|||||||
device = self.wd.list_devices(1)[0]
|
device = self.wd.list_devices(1)[0]
|
||||||
|
|
||||||
with self.assertRaises(subprocess.CalledProcessError):
|
with self.assertRaises(subprocess.CalledProcessError):
|
||||||
subprocess.check_call(['iwctl', '-z',
|
ctx.start_process(['iwctl', '-z', 'station', device.name, 'connect', ssid], check=True)
|
||||||
'station', device.name, 'connect', ssid])
|
|
||||||
|
|
||||||
def test_invalid_command(self):
|
def test_invalid_command(self):
|
||||||
device = self.wd.list_devices(1)[0]
|
device = self.wd.list_devices(1)[0]
|
||||||
|
|
||||||
with self.assertRaises(subprocess.CalledProcessError):
|
with self.assertRaises(subprocess.CalledProcessError):
|
||||||
subprocess.check_call(['iwctl', 'inexistent', 'command'])
|
ctx.start_process(['iwctl', 'inexistent', 'command'], check=True)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
|
Loading…
Reference in New Issue
Block a user