~didrocks/ubuntuone-client/use_result_var

« back to all changes in this revision

Viewing changes to tests/platform/linux/test_vm.py

  • Committer: Bazaar Package Importer
  • Author(s): Rodney Dawes
  • Date: 2011-02-11 16:18:11 UTC
  • mto: This revision was merged to the branch mainline in revision 67.
  • Revision ID: james.westby@ubuntu.com-20110211161811-n18dj9lde7dxqjzr
Tags: upstream-1.5.4
ImportĀ upstreamĀ versionĀ 1.5.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
    LegacyShareFileShelf, _Share, Share, Shared, Root, UDF, _UDF,
27
27
    MetadataUpgrader, VMFileShelf,
28
28
)
29
 
from ubuntuone.platform.linux import get_udf_path
 
29
from ubuntuone.platform.linux import get_udf_path, get_share_path
30
30
 
31
31
 
32
32
class VolumesTests(BaseVolumeManagerTests):
33
33
    """Test UDF/Volumes bits of the VolumeManager."""
34
34
 
35
 
    def test_build_udf_path(self):
36
 
        """Test for VolumeManager._build_udf_path."""
 
35
    def test_get_udf_path(self):
 
36
        """Test for get_udf_path."""
37
37
        suggested_path = u"suggested_path"
38
38
        with environ('HOME', self.home_dir):
39
39
            udf_path = get_udf_path(u"~/" + suggested_path)
41
41
                                       suggested_path.encode('utf-8')),
42
42
                          udf_path)
43
43
 
 
44
    def test_get_share_path(self):
 
45
        """Test for get_share_path."""
 
46
        share_id = uuid.uuid4()
 
47
        name = 'The little pretty share'
 
48
        other_name = 'Dorian Grey'
 
49
        share = self._create_share_volume(volume_id=share_id, name=name,
 
50
                                          other_visible_name=other_name)
 
51
        result = get_share_path(share)
 
52
 
 
53
        expected = '%s (%s, %s)' % (name, other_name, share_id)
 
54
        self.assertEqual(result, expected)
 
55
 
 
56
    def test_get_share_path_visible_name_empty(self):
 
57
        """Test for get_share_path."""
 
58
        share_id = uuid.uuid4()
 
59
        name = 'The little pretty share'
 
60
        other_name = ''
 
61
        share = self._create_share_volume(volume_id=share_id, name=name,
 
62
                                          other_visible_name=other_name)
 
63
        result = get_share_path(share)
 
64
 
 
65
        expected = '%s (%s)' % (name, share_id)
 
66
        self.assertEqual(result, expected)
 
67
 
44
68
 
45
69
class MetadataOldLayoutTests(MetadataTestCase):
46
70
    """Tests for 'old' layouts and metadata upgrade"""