Beispiel #1
0
 def test_read_proc_sys(self):
     m_open = mock.mock_open(read_data="1\n")
     with mock.patch("__builtin__.open", m_open, create=True):
         result = devices._read_proc_sys("/proc/sys/foo/bar")
     calls = [mock.call("/proc/sys/foo/bar", "rb"), M_ENTER, mock.call().read(), M_CLEAN_EXIT]
     m_open.assert_has_calls(calls)
     self.assertEqual(result, "1")
Beispiel #2
0
 def test_read_proc_sys(self):
     m_open = mock.mock_open(read_data="1\n")
     with mock.patch('__builtin__.open', m_open, create=True):
         result = devices._read_proc_sys("/proc/sys/foo/bar")
     calls = [mock.call('/proc/sys/foo/bar', 'rb'),
              M_ENTER, mock.call().read(), M_CLEAN_EXIT]
     m_open.assert_has_calls(calls)
     self.assertEqual(result, "1")