예제 #1
0
    def test_process_IN_MOVED_TO_2(self):
        mocked_monitor = Mock()

        event = Mock()
        event.dir = False
        event.pathname = 'hello'

        # the call to be tested
        handler = EventHandler(mocked_monitor, 17)
        handler.process_IN_DELETE(event)

        mocked_monitor._remove_cached.called_once_with(event.pathname)
예제 #2
0
    def test_process_IN_CREATE_1(self):
        mocked_monitor = Mock()

        event = Mock()
        event.dir = True
        event.pathname = "hello"

        # the call to be tested
        handler = EventHandler(mocked_monitor, 17)
        handler.process_IN_DELETE(event)

        assert mocked_monitor._update_cache.call_count == 0
예제 #3
0
    def test_process_IN_MOVED_TO_1(self):
        mocked_monitor = Mock()

        event = Mock()
        event.dir = True
        event.pathname = 'hello'

        # the call to be tested
        handler = EventHandler(mocked_monitor, 17)
        handler.process_IN_DELETE(event)

        assert mocked_monitor._remove_cached.call_count == 0
예제 #4
0
    def test_process_IN_CREATE_2(self):
        mocked_monitor = Mock()

        event = Mock()
        event.dir = False
        event.pathname = "hello"

        # the call to be tested
        handler = EventHandler(mocked_monitor, 17)
        handler.process_IN_DELETE(event)

        mocked_monitor._update_cache.called_once_with(event.pathname)
예제 #5
0
    def test_process_IN_MOVED_TO_1(self):
        mocked_monitor = Mock()

        event = Mock()
        event.dir = True
        event.pathname = 'hello'

        # the call to be tested
        handler = EventHandler(mocked_monitor, 17)
        handler.process_IN_DELETE(event)

        assert mocked_monitor._remove_cached.call_count == 0
예제 #6
0
    def test_process_IN_CREATE_1(self):
        mocked_monitor = Mock()

        event = Mock()
        event.dir = True
        event.pathname = 'hello'

        # the call to be tested
        handler = EventHandler(mocked_monitor, 17)
        handler.process_IN_DELETE(event)

        eq_(mocked_monitor._update_cache.call_count, 0)
예제 #7
0
    def test_process_IN_MODIFY_2(self):
        mocked_monitor = mock.Mock()

        event = mock.Mock()
        event.dir = False
        event.pathname = "hello"

        # the call to be tested
        handler = EventHandler(mocked_monitor, 17)
        handler.process_IN_DELETE(event)

        mocked_monitor._remove_cached.called_once_with(event.pathname, True)
예제 #8
0
    def test_process_IN_MOVED_TO_2(self):
        mocked_monitor = Mock()

        event = Mock()
        event.dir = False
        event.pathname = 'hello'

        # the call to be tested
        handler = EventHandler(mocked_monitor, 17)
        handler.process_IN_DELETE(event)

        mocked_monitor._remove_cached.called_once_with(
            event.pathname
        )
예제 #9
0
    def test_init(self):
        mocked_monitor = Mock()

        # the call to be tested
        handler = EventHandler(mocked_monitor, 17)

        assert handler.verbosity == 17
        assert handler.monitor is mocked_monitor
    def test_init(self):
        mocked_monitor = Mock()

        # the call to be tested
        handler = EventHandler(mocked_monitor, 17)

        eq_(handler.verbosity, 17)
        ok_(handler.monitor is mocked_monitor)