~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Matt Nordhoff
  • Date: 2009-04-04 02:50:01 UTC
  • mfrom: (4253 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4256.
  • Revision ID: mnordhoff@mattnordhoff.com-20090404025001-z1403k0tatmc8l91
Merge bzr.dev, fixing conflicts.

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
#
13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
 
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
"""Views stored within a working tree.
18
18
 
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."""
157
173
                              % fmt)
158
174
            # it's covered by TestTreeViews
159
175
        TestCaseWithWorkingTree.setUp(self)
160
 
 
 
176
 
161
177
    def test_view_methods_raise(self):
162
178
        wt = self.make_branch_and_tree('wt')
163
179
        self.assertRaises(errors.ViewsNotSupported,