~dobey/ubuntuone-client/fix-test-fails-3-0

« back to all changes in this revision

Viewing changes to tests/syncdaemon/test_vm.py

  • Committer: Tarmac
  • Author(s): Natalia B. Bidart, Diego Sarmentero, Alejandro J. Cura, Brian Curtin, Rodney Dawes
  • Date: 2012-04-03 13:55:40 UTC
  • mfrom: (1179.1.2 stable-3-0-update-2.99.92)
  • Revision ID: tarmac-20120403135540-bvklvxsdh0eo6ite
- Updating from trunk up to revno 1222:

[ Alejandro J. Cura <alecu@canonical.com> ]
  - Do not use the Qt Dbus mainloop on Windows (LP: #969150).
  - Force using the system proxy on Windows (LP: #969157).

[ Diego Sarmentero <diego.sarmentero@canonical.com> ]
  - Converting abspath to unicode (LP: #917222).

[ Natalia B. Bidart <natalia.bidart@canonical.com> ]
  - Fixed typo and added a missing test for validate_path in
    SyncDaemonTool (LP: #968637).

[ Natalia B. Bidart <natalia.bidart@canonical.com>,
  Brian Curtin <brian.curtin@canonical.com> ]
  - Emit a notification when volumes are ready after a server rescan,
    allowing clients to follow and update their information accordingly
    (LP: #851810).

[ Rodney Dawes <rodney.dawes@canonical.com> ]
  - Use set_hint_int32 for the boolean transient hint instead of set_hint
    (LP: #961342).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1893
1893
        """Test handle_AQ_LIST_VOLUMES event with an inactive udf."""
1894
1894
        yield self._test_handle_AQ_LIST_VOLUMES_udf(False)
1895
1895
 
 
1896
    @defer.inlineCallbacks
 
1897
    def test_handle_AQ_LIST_VOLUMES_emits_volumes_changed(self):
 
1898
        """When handling a new volume list, VM_VOLUMES_CHANGED is pushed."""
 
1899
        share = self._create_share_volume()
 
1900
        udf = self._create_udf_volume()
 
1901
        root_volume = volumes.RootVolume(uuid.uuid4(), 17, 10)
 
1902
        response = [share, udf, root_volume]
 
1903
 
 
1904
        udf_created_d = defer.Deferred()
 
1905
        self._listen_for('VM_UDF_CREATED', udf_created_d.callback)
 
1906
 
 
1907
        volumes_changed_d = defer.Deferred()
 
1908
        self._listen_for('VM_VOLUMES_CHANGED', volumes_changed_d.callback)
 
1909
 
 
1910
        self.vm.handle_AQ_LIST_VOLUMES(response)
 
1911
 
 
1912
        yield udf_created_d
 
1913
        actual = yield volumes_changed_d
 
1914
        expected = {'volumes': list(self.vm.get_volumes(all_volumes=True))}
 
1915
        self.assertEqual(expected, actual)
 
1916
 
1896
1917
 
1897
1918
class VolumeManagerOperationsTests(BaseVolumeManagerTests):
1898
1919
    """Test UDF/Volumes operations."""
3104
3125
                         vol_rescan_d.callback)  # autosubscribe is False
3105
3126
        server_rescan_d = defer.Deferred()
3106
3127
        self._listen_for('SYS_SERVER_RESCAN_DONE', server_rescan_d.callback)
 
3128
        volumes_changed_d = defer.Deferred()
 
3129
        self._listen_for('VM_VOLUMES_CHANGED', volumes_changed_d.callback)
3107
3130
        yield self.vm.server_rescan()
3108
3131
        yield server_rescan_d
3109
3132
        events = yield vol_rescan_d
 
3133
        vols = yield volumes_changed_d
3110
3134
 
3111
3135
        self.assertEqual({'generation': 1, 'volume_id': ''}, events)
3112
3136
 
 
3137
        expected = list(self.vm.get_volumes(all_volumes=True))
 
3138
        self.assertEqual({'volumes' : expected}, vols)
 
3139
 
3113
3140
    @defer.inlineCallbacks
3114
3141
    def test_server_rescan_with_share_autosubscribe(self):
3115
3142
        """Test the server_rescan method."""