Skip to content
This repository has been archived by the owner on Apr 1, 2020. It is now read-only.

Commit

Permalink
in mock we trust
Browse files Browse the repository at this point in the history
  • Loading branch information
zeph committed Aug 30, 2019
1 parent 94bf1ab commit 3035004
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tests/testwnettools.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import unittest
from unittest import mock
from wicd import wnettools

class TestWnettools(unittest.TestCase):
Expand All @@ -11,9 +12,13 @@ def test_find_wireless_interface(self):
#self.assertTrue('wlan0' in interfaces)
self.assertTrue(type(interfaces) == list)

def test_find_wired_interface(self):
@mock.patch('wicd.wnettools.os')
@mock.patch('wicd.wnettools.open')
def test_find_wired_interface(self, mock_f, mock_os):
mock_os.listdir.return_value = ['eth0']
mock_os.path.isdir.return_value = True
mock_f.return_value.readlines.return_value = "1"
interfaces = wnettools.GetWiredInterfaces()
# eth0 may change depending on your system
self.assertTrue('eth0' in interfaces)

def test_wext_is_valid_wpasupplicant_driver(self):
Expand Down

0 comments on commit 3035004

Please sign in to comment.