~ralsina/ubuntuone-client/verify-harder

« back to all changes in this revision

Viewing changes to tests/platform/filesystem_notifications/test_filesystem_notifications.py

  • Committer: Tarmac
  • Author(s): Manuel de la Pena
  • Date: 2012-07-31 09:26:31 UTC
  • mfrom: (1280.2.3 clean-imports)
  • Revision ID: tarmac-20120731092631-8dvbf012dtwxdfyh
- Clean the location of the filemonitor imports (LP:1026212).

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
    remove_dir,
47
47
    rename,
48
48
)
49
 
from ubuntuone.platform.filesystem_notifications import (
50
 
    _GeneralINotifyProcessor,
51
 
)
 
49
from ubuntuone.platform.filesystem_notifications import notify_processor
52
50
from ubuntuone.syncdaemon.tritcask import Tritcask
53
51
from ubuntuone.syncdaemon import (
54
52
    event_queue,
62
60
 
63
61
    def test_filter_none(self):
64
62
        """Still works ok even if not receiving a regex to ignore."""
65
 
        p = _GeneralINotifyProcessor(None)
 
63
        p = notify_processor.NotifyProcessor(None)
66
64
        self.assertFalse(p.is_ignored("froo.pyc"))
67
65
 
68
66
    def test_filter_one(self):
69
67
        """Filters stuff that matches (or not) this one regex."""
70
 
        p = _GeneralINotifyProcessor(None, ['\A.*\\.pyc\Z'])
 
68
        p = notify_processor.NotifyProcessor(None, ['\A.*\\.pyc\Z'])
71
69
        self.assertTrue(p.is_ignored("froo.pyc"))
72
70
        self.assertFalse(p.is_ignored("froo.pyc.real"))
73
71
        self.assertFalse(p.is_ignored("otherstuff"))
74
72
 
75
73
    def test_filter_two_simple(self):
76
74
        """Filters stuff that matches (or not) these simple regexes."""
77
 
        p = _GeneralINotifyProcessor(None, ['\A.*foo\Z', '\A.*bar\Z'])
 
75
        p = notify_processor.NotifyProcessor(None, ['\A.*foo\Z', '\A.*bar\Z'])
78
76
        self.assertTrue(p.is_ignored("blah_foo"))
79
77
        self.assertTrue(p.is_ignored("blah_bar"))
80
78
        self.assertFalse(p.is_ignored("bar_xxx"))
83
81
 
84
82
    def test_filter_two_complex(self):
85
83
        """Filters stuff that matches (or not) these complex regexes."""
86
 
        p = _GeneralINotifyProcessor(None,
 
84
        p = notify_processor.NotifyProcessor(None,
87
85
                                     ['\A.*foo\Z|\Afoo.*\Z', '\A.*bar\Z'])
88
86
        self.assertTrue(p.is_ignored("blah_foo"))
89
87
        self.assertTrue(p.is_ignored("blah_bar"))
98
96
        store_call = lambda *args: calls.append(args)
99
97
        self.patch(filesystem_notifications, "access", store_call)
100
98
        self.patch(filesystem_notifications, "path_exists", lambda _: True)
101
 
        p = _GeneralINotifyProcessor(None)
 
99
        p = notify_processor.NotifyProcessor(None)
102
100
        p.is_ignored(sample_path)
103
101
        self.assertEqual(calls, [(sample_path,)])
104
102