def choose_sync_strategies(self): """Determines the sync strategy for the command. It defaults to the default sync strategies but a customizable sync strategy can overide the default strategy if it returns the instance of its self when the event is emitted. """ sync_strategies = {} # Set the default strategies. sync_strategies['file_at_src_and_dest_sync_strategy'] = \ SizeAndLastModifiedSync() sync_strategies['file_not_at_dest_sync_strategy'] = MissingFileSync() sync_strategies['file_not_at_src_sync_strategy'] = NeverSync() # Determine what strategies to overide if any. responses = self.session.emit('choosing-s3-sync-strategy', params=self.parameters) if responses is not None: for response in responses: override_sync_strategy = response[1] if override_sync_strategy is not None: sync_type = override_sync_strategy.sync_type sync_type += '_sync_strategy' sync_strategies[sync_type] = override_sync_strategy return sync_strategies
def setUp(self): self.sync_strategy = NeverSync()