Exemplo n.º 1
0
 def setUp(self):
     self.subscriber = RecordingSubscriber()
     self.second_subscriber = RecordingSubscriber()
     self.call_args = CallArgs(
         subscribers=[self.subscriber, self.second_subscriber])
     self.transfer_meta = TransferMeta(self.call_args)
     self.transfer_future = TransferFuture(self.transfer_meta)
Exemplo n.º 2
0
 def _get_future_with_components(self, call_args):
     transfer_id = self._id_counter
     # Creates a new transfer future along with its components
     transfer_coordinator = TransferCoordinator(transfer_id=transfer_id)
     # Track the transfer coordinator for transfers to manage.
     self._coordinator_controller.add_transfer_coordinator(
         transfer_coordinator)
     # Also make sure that the transfer coordinator is removed once
     # the transfer completes so it does not stick around in memory.
     transfer_coordinator.add_done_callback(
         self._coordinator_controller.remove_transfer_coordinator,
         transfer_coordinator)
     components = {
         'meta': TransferMeta(call_args, transfer_id=transfer_id),
         'coordinator': transfer_coordinator
     }
     transfer_future = TransferFuture(**components)
     return transfer_future, components
Exemplo n.º 3
0
 def setUp(self):
     self.transfer_meta = TransferMeta()
Exemplo n.º 4
0
 def setUp(self):
     self.meta = TransferMeta()
     self.coordinator = TransferCoordinator()
     self.future = self._get_transfer_future()
Exemplo n.º 5
0
 def test_transfer_id(self):
     transfer_meta = TransferMeta(transfer_id=1)
     self.assertEqual(transfer_meta.transfer_id, 1)
Exemplo n.º 6
0
 def test_call_args(self):
     call_args = object()
     transfer_meta = TransferMeta(call_args)
     # Assert the that call args provided is the same as is returned
     self.assertIs(transfer_meta.call_args, call_args)
 def setUp(self):
     self.transfer_future = mock.Mock(spec=TransferFuture)
     self.transfer_meta = TransferMeta()
     self.transfer_future.meta = self.transfer_meta
Exemplo n.º 8
0
 def get_transfer_future(self, call_args=None):
     return TransferFuture(meta=TransferMeta(call_args),
                           coordinator=self.transfer_coordinator)