~ubuntu-branches/ubuntu/precise/ubuntuone-client/precise-201112142106

« 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-08-09 12:47:56 UTC
  • mfrom: (1.1.53 upstream)
  • Revision ID: james.westby@ubuntu.com-20110809124756-7nzilp3oix0a1yl9
Tags: 1.7.1-0ubuntu1
* New upstream release.
* debian/*:
  - Removed obsolete pycompat file
  - Removed ubuntuone-client-gnome deps and binary packaging, as it was
    moved out to separate project upstream.
  - Updated copyright to remove obsolete file reference
* debian/patches:
  - Removed patches which have been included upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
from tests.syncdaemon.test_vm import MetadataTestCase, BaseVolumeManagerTests
24
24
from ubuntuone.storageprotocol import request
25
25
from ubuntuone.syncdaemon.volume_manager import (
 
26
    get_udf_path,
26
27
    LegacyShareFileShelf, _Share, Share, Shared, Root, UDF, _UDF,
27
28
    MetadataUpgrader, VMFileShelf,
28
29
)
29
 
from ubuntuone.platform.linux import get_udf_path, get_share_path
30
30
 
31
31
 
32
32
class VolumesTests(BaseVolumeManagerTests):
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
 
 
68
 
 
69
44
class MetadataOldLayoutTests(MetadataTestCase):
70
45
    """Tests for 'old' layouts and metadata upgrade"""
71
46
 
76
51
        self.new_root_dir = self.u1_dir
77
52
        self.new_shares_dir = self.mktemp('shares_dir')
78
53
 
79
 
    def tearDown(self):
80
 
        """Cleanup all the cruft."""
81
 
        for path in [self.u1_dir, self.new_shares_dir]:
82
 
            if path and os.path.exists(path):
83
 
                self.rmtree(path)
84
 
        MetadataTestCase.tearDown(self)
85
 
 
86
54
    def _build_layout_version_0(self):
87
55
        """Build the dir structure to mimic md v.0/None."""
88
56
        self.share_md_dir = os.path.join(self.tmpdir, 'data_dir', 'vm')