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

« back to all changes in this revision

Viewing changes to tests/platform/linux/test_tools.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:
29
29
 
30
30
from ubuntuone.devtools.handlers import MementoHandler
31
31
 
32
 
from ubuntuone.platform.linux import dbus_interface, tools, get_udf_path
 
32
from ubuntuone.platform.linux import dbus_interface, tools
33
33
from tests.platform.linux.test_dbus import (
34
34
    FakeCommand, DBusTwistedTestCase, AllEventsSender,
35
35
)
47
47
        self.home_dir = self.mktemp('ubuntuonehacker')
48
48
        old_home = os.environ['HOME']
49
49
        os.environ['HOME'] = self.home_dir
50
 
        self.addCleanup(lambda: os.environ.__setitem__('HOME', old_home))
51
 
        self.addCleanup(lambda: self.rmtree(self.home_dir))
 
50
        self.addCleanup(os.environ.__setitem__, 'HOME', old_home)
52
51
        self.handler = MementoHandler()
53
52
        self.tool.log.addHandler(self.handler)
54
53
        yield self.main.wait_for_nirvana()
75
74
 
76
75
    def _create_udf(self, volume_id, node_id, suggested_path, subscribed=True):
77
76
        """Create an UDF and returns it and the volume"""
78
 
        path = get_udf_path(suggested_path)
 
77
        path = volume_manager.get_udf_path(suggested_path)
79
78
        udf = volume_manager.UDF(str(volume_id), str(node_id), suggested_path,
80
79
                                 path, subscribed)
81
80
        return udf
307
306
        return d
308
307
 
309
308
    @defer.inlineCallbacks
 
309
    def test_free_space(self):
 
310
        """Test SyncDaemonTool.waiting."""
 
311
        share_path = os.path.join(self.main.shares_dir, 'share')
 
312
        share = volume_manager.Share(path=share_path, volume_id='vol_id')
 
313
        yield self.main.vm.add_share(share)
 
314
 
 
315
        self.main.vm.update_free_space('vol_id', 12345)
 
316
        result = yield self.tool.free_space('vol_id')
 
317
        self.assertEqual(result, 12345)
 
318
 
 
319
    @defer.inlineCallbacks
310
320
    def test_waiting_simple(self):
311
321
        """Test SyncDaemonTool.waiting."""
312
322
        # inject the fake data