File: 0003-tests-add-integration-test-for-wifi-psk-sha256.patch

package info (click to toggle)
netplan.io 1.1.2-8
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,440 kB
  • sloc: python: 34,441; ansic: 13,683; xml: 4,989; javascript: 2,165; sh: 419; makefile: 118
file content (58 lines) | stat: -rw-r--r-- 2,205 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
From: Danilo Egea Gondolfo <danilogondolfo@gmail.com>
Date: Wed, 18 Dec 2024 13:02:27 +0000
Subject: tests: add integration test for wifi/psk-sha256

Origin: https://github.com/canonical/netplan/commit/53636f1daa8d70c00a059a09404eb3e3a54ead8f
Forwarded: not-needed
---
 tests/integration/wifi.py | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/tests/integration/wifi.py b/tests/integration/wifi.py
index 72efffd..94ce123 100644
--- a/tests/integration/wifi.py
+++ b/tests/integration/wifi.py
@@ -111,6 +111,43 @@ wpa_passphrase=12345678
                                           text=True)
             self.assertRegex(out, 'DNS.*192.168.5.1')
 
+    def test_wifi_ipv4_wpa2_psk_sha256_only(self):
+        self.setup_ap('''hw_mode=g
+channel=1
+ssid=fake net
+wpa=2
+wpa_key_mgmt=WPA-PSK-SHA256
+wpa_pairwise=CCMP
+ieee80211w=2
+wpa_passphrase=12345678
+''', None)
+
+        with open(self.config, 'w') as f:
+            f.write('''network:
+  renderer: %(r)s
+  wifis:
+    %(wc)s:
+      dhcp4: yes
+      access-points:
+        "fake net":
+          auth:
+            key-management: psk-sha256
+            password: 12345678
+        decoy: {}''' % {'r': self.backend, 'wc': self.dev_w_client})
+        self.generate_and_settle([self.state_dhcp4(self.dev_w_client)])
+        self.assert_iface_up(self.dev_w_client, ['inet 192.168.5.[0-9]+/24'])
+        self.assertIn(b'default via 192.168.5.1',  # from DHCP
+                      subprocess.check_output(['ip', 'route', 'show', 'dev', self.dev_w_client]))
+        if self.backend == 'NetworkManager':
+            out = subprocess.check_output(['nmcli', 'dev', 'show', self.dev_w_client],
+                                          text=True)
+            self.assertRegex(out, 'GENERAL.CONNECTION.*netplan-%s-fake net' % self.dev_w_client)
+            self.assertRegex(out, 'IP4.DNS.*192.168.5.1')
+        else:
+            out = subprocess.check_output(['networkctl', 'status', self.dev_w_client],
+                                          text=True)
+            self.assertRegex(out, 'DNS.*192.168.5.1')
+
     def test_wifi_regdom(self):
         self.setup_ap('''hw_mode=g
 channel=1