From: Martin Vidner Date: Thu, 13 Aug 2009 21:31:51 +0000 (+0200) Subject: Fixed the --wep-* and --wpa-* options (Gentoo#281099). X-Git-Url: http://repo.or.cz/w/cnetworkmanager.git?a=commitdiff_plain Fixed the --wep-* and --wpa-* options (Gentoo#281099). The constructors had wrong super calls, duh. And there was a typo in "ccmp". http://bugs.gentoo.org/show_bug.cgi?id=281099 --- diff --git a/Makefile b/Makefile index 0ba0c93..5900426 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ check: check-nonm check-nonm: for T in `find . -name \*.py | xargs grep -l '>>>'`; do python $$T; done - for T in test/test01*.py; do $$T; done + for T in test/test01*.py; do PYTHONPATH=. $$T; done install: $(SETUP) install diff --git a/networkmanager/applet/settings.py b/networkmanager/applet/settings.py index bc22291..5ceacba 100644 --- a/networkmanager/applet/settings.py +++ b/networkmanager/applet/settings.py @@ -104,7 +104,7 @@ class Wep(WiFi): def __init__(self, ssid, key, hashed_key=""): "One of key, hashed_key must be present" - super(WiFi, self).__init__(ssid) + super(Wep, self).__init__(ssid) self["802-11-wireless"]["security"] = "802-11-wireless-security" self["802-11-wireless-security"] = {} self["802-11-wireless-security"]["key-mgmt"] = "none" @@ -126,10 +126,10 @@ class WpaPsk(WiFi): def __init__(self, ssid, key, hashed_key=""): "One of key, hashed_key must be present" - super(WiFi, self).__init__(ssid) + super(WpaPsk, self).__init__(ssid) self["802-11-wireless"]["security"] = "802-11-wireless-security" self["802-11-wireless-security"] = {} - self["802-11-wireless-security"]["group"] = ["tkip", "cselfp"] + self["802-11-wireless-security"]["group"] = ["tkip", "ccmp"] self["802-11-wireless-security"]["pairwise"] = ["tkip", "ccmp"] self["802-11-wireless-security"]["key-mgmt"] = "wpa-psk" if hashed_key == "": diff --git a/test/test01-nofail.py b/test/test01-nofail.py index c4ca60c..a908e5d 100755 --- a/test/test01-nofail.py +++ b/test/test01-nofail.py @@ -4,6 +4,8 @@ import subprocess import sys import unittest +import networkmanager.applet.settings as settings + class NoFail(unittest.TestCase): def callIt(self, params): cmd = sys.path[0] + '/../cnetworkmanager' @@ -19,5 +21,21 @@ class NoFail(unittest.TestCase): def testHelp(self): self.callIt("--help") +class SettingsFactory(unittest.TestCase): + def testWiFi(self): + ssid = "foo" + c = settings.WiFi(ssid) + + def testWep(self): + ssid = "foo" + c1 = settings.Wep(ssid, "wep_pass") + c2 = settings.Wep(ssid, "", "ffffffffffffffffffffffffff") + + def testWpa(self): + ssid = "foo" + c1 = settings.WpaPsk(ssid, "wep_pass") + c2 = settings.WpaPsk(ssid, "", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") + + if __name__ == '__main__': unittest.main()