示例#1
0
 def test_for_mock_callback_create(self):
     mock_receiver = Mock(Receiver)
     fs = FileSystemWatcher('/foo/bar')
     fs.onChangeCallbacks = dict(create=mock_receiver.subscribeTarget,
                                 delete=mock_receiver.unsubscribeTarget)
     fs.onChange('watch', self.PATH, self.CREATE)
     self.assertTrue(mock_receiver.subscribeTarget.called)
示例#2
0
 def test_inotify_is_started(self, mock_inotify):
     fs = FileSystemWatcher('/foo/bar')
     fs.startService()
     self.assertTrue(mock_inotify.INotify().startReading.called)
示例#3
0
 def test_for_missing_callbacks(self):
     fs = FileSystemWatcher('/foo/bar')
     self.assertRaises(
         AttributeError, fs.onChange, 'watch', self.PATH, self.CREATE)