From 07b3b1330a5d98997b1bba4fa583a78fea402f64 Mon Sep 17 00:00:00 2001 From: Joseph Walton Date: Fri, 7 Feb 2020 01:11:26 +1100 Subject: [PATCH] Add test for when the interface doesn't exist Add a regression test for the fix in 72e4882ed1a. --- test/test_get_iwconfig.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 test/test_get_iwconfig.py diff --git a/test/test_get_iwconfig.py b/test/test_get_iwconfig.py new file mode 100644 index 0000000..9836c5f --- /dev/null +++ b/test/test_get_iwconfig.py @@ -0,0 +1,12 @@ +import unittest + + +class TestGetIwconfig(unittest.TestCase): + def test_message_when_no_such_device(self): + from iwlib import get_iwconfig + + with self.assertRaises(OSError) as context: + get_iwconfig('no-such-device') + + self.assertIn("Could not get config for 'no-such-device'", + context.exception.strerror)