Skip to content

Commit 879a0e7

Browse files
author
Ritwick DSouza
committed
[raspbian] Added tests for wep station mode
1 parent f6dbdf4 commit 879a0e7

1 file changed

Lines changed: 91 additions & 0 deletions

File tree

tests/raspbian/test_wpasupplicant.py

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,97 @@
66

77
class TestWpaSupplicant(unittest.TestCase, _TabsMixin):
88

9+
def test_wep_open(self):
10+
o = Raspbian({
11+
"interfaces": [
12+
{
13+
"name": "wlan0",
14+
"type": "wireless",
15+
"wireless": {
16+
"mode": "station",
17+
"radio": "radio0",
18+
"ssid": "wep-test",
19+
"bssid": "01:23:45:67:89:ab",
20+
"encryption": {
21+
"protocol": "wep_open",
22+
"key": "12345"
23+
}
24+
},
25+
}
26+
]
27+
})
28+
29+
expected = '''# config: /etc/wpa_supplicant/wpa_supplicant.conf
30+
31+
network={
32+
ssid="wep-test"
33+
key_mgmt=NONE
34+
wep_key0="12345"
35+
}
36+
37+
# config: /etc/network/interfaces
38+
39+
auto wlan0
40+
iface wlan0 inet manual
41+
42+
# script: /scripts/ipv4_forwarding.sh
43+
44+
sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"
45+
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
46+
sudo iptables -A FORWARD -i eth0 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT
47+
sudo iptables -A FORWARD -i wlan0 -o eth0 -j ACCEPT
48+
sudo sh -c "iptables-save > /etc/iptables.ipv4.nat"
49+
50+
'''
51+
52+
self.assertEqual(o.render(), expected)
53+
54+
def test_wep_shared(self):
55+
o = Raspbian({
56+
"interfaces": [
57+
{
58+
"name": "wlan0",
59+
"type": "wireless",
60+
"wireless": {
61+
"mode": "station",
62+
"radio": "radio0",
63+
"ssid": "wep-test",
64+
"bssid": "01:23:45:67:89:ab",
65+
"encryption": {
66+
"protocol": "wep_shared",
67+
"key": "12345"
68+
}
69+
},
70+
}
71+
]
72+
})
73+
74+
expected = '''# config: /etc/wpa_supplicant/wpa_supplicant.conf
75+
76+
network={
77+
ssid="wep-test"
78+
key_mgmt=NONE
79+
wep_key0="12345"
80+
auth_algs=shared
81+
}
82+
83+
# config: /etc/network/interfaces
84+
85+
auto wlan0
86+
iface wlan0 inet manual
87+
88+
# script: /scripts/ipv4_forwarding.sh
89+
90+
sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"
91+
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
92+
sudo iptables -A FORWARD -i eth0 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT
93+
sudo iptables -A FORWARD -i wlan0 -o eth0 -j ACCEPT
94+
sudo sh -c "iptables-save > /etc/iptables.ipv4.nat"
95+
96+
'''
97+
98+
self.assertEqual(o.render(), expected)
99+
9100
def test_wpa2_personal_sta(self):
10101
o = Raspbian({
11102
"radios": [

0 commit comments

Comments
 (0)