~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/workingtree_implementations/test_views.py

  • Committer: Eduardo Padoan
  • Date: 2009-02-23 15:55:10 UTC
  • mto: (4048.1.1 ianc-integration)
  • mto: This revision was merged to the branch mainline in revision 4052.
  • Revision ID: eduardo.padoan@gmail.com-20090223155510-wyxf2xykkspqugjt
Added tests for views.check_path_in_view()

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
"""
22
22
 
23
23
 
24
 
from bzrlib import errors
 
24
from bzrlib import views, errors
25
25
from bzrlib.tests import TestSkipped
26
26
from bzrlib.workingtree import WorkingTree
27
27
 
141
141
        self.assertRaises(errors.NoSuchView,
142
142
            wt.views.delete_view, view_name + '2')
143
143
 
 
144
    def test_check_path_in_view(self):
 
145
        wt = self.make_branch_and_tree('wt')
 
146
        view_current = 'view-name'
 
147
        view_dict = {
 
148
            view_current: ['dir-1'],
 
149
            'other-name': ['dir-2']}
 
150
        wt.views.set_view_info(view_current, view_dict)
 
151
        self.assertEqual(views.check_path_in_view(wt, 'dir-1'), None)
 
152
        self.assertEqual(views.check_path_in_view(wt, 'dir-1/sub'), None)
 
153
        self.assertRaises(errors.FileOutsideView,
 
154
                          views.check_path_in_view, wt, 'dir-2')
 
155
        self.assertRaises(errors.FileOutsideView,
 
156
                          views.check_path_in_view, wt, 'dir-2/sub')
 
157
        self.assertRaises(errors.FileOutsideView,
 
158
                          views.check_path_in_view, wt, 'other')
 
159
 
144
160
 
145
161
class TestUnsupportedViews(TestCaseWithWorkingTree):
146
162
    """Formats that don't support views should give reasonable errors."""