From 5af52f519be512deb33a519f4d9fb7b7bfa41618 Mon Sep 17 00:00:00 2001 From: Markus Ongyerth Date: Wed, 14 Dec 2016 23:15:31 +0100 Subject: [PATCH] autotests: add autotest for eap-mschapv2 --- autotests/misc/secrets/eap-user-mschapv2.text | 1 + autotests/testEAP-MSCHAPV2/connection_test.py | 56 +++++++++++++++++++ autotests/testEAP-MSCHAPV2/hw.conf | 6 ++ .../testEAP-MSCHAPV2/ssidEAP-MSCHAPV2.8021x | 4 ++ .../testEAP-MSCHAPV2/ssidEAP-MSCHAPV2.conf | 9 +++ 5 files changed, 76 insertions(+) create mode 100644 autotests/misc/secrets/eap-user-mschapv2.text create mode 100644 autotests/testEAP-MSCHAPV2/connection_test.py create mode 100644 autotests/testEAP-MSCHAPV2/hw.conf create mode 100644 autotests/testEAP-MSCHAPV2/ssidEAP-MSCHAPV2.8021x create mode 100644 autotests/testEAP-MSCHAPV2/ssidEAP-MSCHAPV2.conf diff --git a/autotests/misc/secrets/eap-user-mschapv2.text b/autotests/misc/secrets/eap-user-mschapv2.text new file mode 100644 index 00000000..b18410d3 --- /dev/null +++ b/autotests/misc/secrets/eap-user-mschapv2.text @@ -0,0 +1 @@ +"domain\User" MSCHAPV2 "Password" diff --git a/autotests/testEAP-MSCHAPV2/connection_test.py b/autotests/testEAP-MSCHAPV2/connection_test.py new file mode 100644 index 00000000..350cac8e --- /dev/null +++ b/autotests/testEAP-MSCHAPV2/connection_test.py @@ -0,0 +1,56 @@ +#!/usr/bin/python3 + +import unittest +import sys + +sys.path.append('../util') +import iwd +from iwd import IWD +from iwd import NetworkType + +class Test(unittest.TestCase): + + def test_connection_success(self): + wd = IWD() + + devices = wd.list_devices(); + self.assertIsNotNone(devices) + device = devices[0] + + condition = 'not obj.scanning' + wd.wait_for_object_condition(device, condition) + + device.scan() + + condition = 'not obj.scanning' + wd.wait_for_object_condition(device, condition) + + ordered_networks = device.get_ordered_networks() + ordered_network = ordered_networks[0] + + self.assertEqual(ordered_network.name, "ssidEAP-MSCHAPV2") + self.assertEqual(ordered_network.type, NetworkType.eap) + + condition = 'not obj.connected' + wd.wait_for_object_condition(ordered_network.network_object, condition) + + ordered_network.network_object.connect() + + condition = 'obj.connected' + wd.wait_for_object_condition(ordered_network.network_object, condition) + + device.disconnect() + + condition = 'not obj.connected' + wd.wait_for_object_condition(ordered_network.network_object, condition) + + @classmethod + def setUpClass(cls): + IWD.copy_to_storage('ssidEAP-MSCHAPV2.8021x') + + @classmethod + def tearDownClass(cls): + IWD.clear_storage() + +if __name__ == '__main__': + unittest.main(exit=True) diff --git a/autotests/testEAP-MSCHAPV2/hw.conf b/autotests/testEAP-MSCHAPV2/hw.conf new file mode 100644 index 00000000..1d5539ad --- /dev/null +++ b/autotests/testEAP-MSCHAPV2/hw.conf @@ -0,0 +1,6 @@ +[SETUP] +num_radios=2 +tmpfs_extra_stuff=../misc/secrets + +[HOSTAPD] +rad0=ssidEAP-MSCHAPV2.conf diff --git a/autotests/testEAP-MSCHAPV2/ssidEAP-MSCHAPV2.8021x b/autotests/testEAP-MSCHAPV2/ssidEAP-MSCHAPV2.8021x new file mode 100644 index 00000000..2d927e17 --- /dev/null +++ b/autotests/testEAP-MSCHAPV2/ssidEAP-MSCHAPV2.8021x @@ -0,0 +1,4 @@ +[Security] +EAP-Method=MSCHAPV2 +EAP-Identity=domain\User +EAP-Password=Password diff --git a/autotests/testEAP-MSCHAPV2/ssidEAP-MSCHAPV2.conf b/autotests/testEAP-MSCHAPV2/ssidEAP-MSCHAPV2.conf new file mode 100644 index 00000000..014f730b --- /dev/null +++ b/autotests/testEAP-MSCHAPV2/ssidEAP-MSCHAPV2.conf @@ -0,0 +1,9 @@ +hw_mode=g +channel=1 +ssid=ssidEAP-MSCHAPV2 + +wpa=3 +wpa_key_mgmt=WPA-EAP +ieee8021x=1 +eap_server=1 +eap_user_file=/tmp/secrets/eap-user-mschapv2.text