/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/tree_implementations/test_get_symlink_target.py

First attempt to merge .dev and resolve the conflicts (but tests are 
failing)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright (C) 2007 Canonical Ltd
 
2
#
 
3
# This program is free software; you can redistribute it and/or modify
 
4
# it under the terms of the GNU General Public License as published by
 
5
# the Free Software Foundation; either version 2 of the License, or
 
6
# (at your option) any later version.
 
7
#
 
8
# This program is distributed in the hope that it will be useful,
 
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
11
# GNU General Public License for more details.
 
12
#
 
13
# You should have received a copy of the GNU General Public License
 
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
 
16
 
 
17
"""Test that all Tree's implement get_symlink_target"""
 
18
 
 
19
import os
 
20
 
 
21
from bzrlib import (
 
22
    errors,
 
23
    osutils,
 
24
    tests,
 
25
    )
 
26
from bzrlib.tests.tree_implementations import TestCaseWithTree
 
27
 
 
28
 
 
29
class TestGetSymlinkTarget(TestCaseWithTree):
 
30
 
 
31
    def get_tree_with_symlinks(self):
 
32
        self.requireFeature(tests.SymlinkFeature)
 
33
        tree = self.make_branch_and_tree('tree')
 
34
        os.symlink('foo', 'tree/link')
 
35
        os.symlink('../bar', 'tree/rel_link')
 
36
        os.symlink('/baz/bing', 'tree/abs_link')
 
37
 
 
38
        tree.add(['link', 'rel_link', 'abs_link'],
 
39
                 ['link-id', 'rel-link-id', 'abs-link-id'])
 
40
        return self._convert_tree(tree)
 
41
 
 
42
    def test_get_symlink_target(self):
 
43
        tree = self.get_tree_with_symlinks()
 
44
        tree.lock_read()
 
45
        self.addCleanup(tree.unlock)
 
46
        self.assertEqual('foo', tree.get_symlink_target('link-id'))
 
47
        self.assertEqual('../bar', tree.get_symlink_target('rel-link-id'))
 
48
        self.assertEqual('/baz/bing', tree.get_symlink_target('abs-link-id'))