コード例 #1
0
ファイル: test_ds_util.py プロジェクト: bopopescu/nova-26
    def test_file_move(self):
        def fake_call_method(module, method, *args, **kwargs):
            self.assertEqual('MoveDatastoreFile_Task', method)
            sourceName = kwargs.get('sourceName')
            self.assertEqual('[ds] tmp/src', sourceName)
            destinationName = kwargs.get('destinationName')
            self.assertEqual('[ds] base/dst', destinationName)
            sourceDatacenter = kwargs.get('sourceDatacenter')
            self.assertEqual('fake-dc-ref', sourceDatacenter)
            destinationDatacenter = kwargs.get('destinationDatacenter')
            self.assertEqual('fake-dc-ref', destinationDatacenter)
            return 'fake_move_task'

        with contextlib.nested(
                mock.patch.object(self.session, '_wait_for_task'),
                mock.patch.object(self.session, '_call_method',
                                  fake_call_method)) as (_wait_for_task,
                                                         _call_method):
            ds_util.file_move(self.session, 'fake-dc-ref', '[ds] tmp/src',
                              '[ds] base/dst')
            _wait_for_task.assert_has_calls([mock.call('fake_move_task')])
コード例 #2
0
    def test_file_move(self):
        def fake_call_method(module, method, *args, **kwargs):
            self.assertEqual("MoveDatastoreFile_Task", method)
            sourceName = kwargs.get("sourceName")
            self.assertEqual("[ds] tmp/src", sourceName)
            destinationName = kwargs.get("destinationName")
            self.assertEqual("[ds] base/dst", destinationName)
            sourceDatacenter = kwargs.get("sourceDatacenter")
            self.assertEqual("fake-dc-ref", sourceDatacenter)
            destinationDatacenter = kwargs.get("destinationDatacenter")
            self.assertEqual("fake-dc-ref", destinationDatacenter)
            return "fake_move_task"

        with contextlib.nested(
            mock.patch.object(self.session, "_wait_for_task"),
            mock.patch.object(self.session, "_call_method", fake_call_method),
        ) as (_wait_for_task, _call_method):
            src_ds_path = ds_util.DatastorePath("ds", "tmp/src")
            dst_ds_path = ds_util.DatastorePath("ds", "base/dst")
            ds_util.file_move(self.session, "fake-dc-ref", src_ds_path, dst_ds_path)
            _wait_for_task.assert_has_calls([mock.call("fake_move_task")])
コード例 #3
0
ファイル: test_ds_util.py プロジェクト: e0ne/nova
    def test_file_move(self):
        def fake_call_method(module, method, *args, **kwargs):
            self.assertEqual('MoveDatastoreFile_Task', method)
            sourceName = kwargs.get('sourceName')
            self.assertEqual('[ds] tmp/src', sourceName)
            destinationName = kwargs.get('destinationName')
            self.assertEqual('[ds] base/dst', destinationName)
            sourceDatacenter = kwargs.get('sourceDatacenter')
            self.assertEqual('fake-dc-ref', sourceDatacenter)
            destinationDatacenter = kwargs.get('destinationDatacenter')
            self.assertEqual('fake-dc-ref', destinationDatacenter)
            return 'fake_move_task'

        with contextlib.nested(
            mock.patch.object(self.session, '_wait_for_task'),
            mock.patch.object(self.session, '_call_method',
                              fake_call_method)
        ) as (_wait_for_task, _call_method):
            ds_util.file_move(self.session,
                              'fake-dc-ref', '[ds] tmp/src', '[ds] base/dst')
            _wait_for_task.assert_has_calls([
                   mock.call('fake_move_task')])