コード例 #1
0
 def test_fee_converts_to_lbc(self):
     fee = Claim().stream.fee
     fee.usd = Decimal(10.0)
     fee.address = "bRcHraa8bYJZL7vkh5sNmGwPDERFUjGPP9"
     manager = get_fake_exchange_rate_manager()
     result = manager.convert_currency(fee.currency, "LBC", fee.amount)
     self.assertEqual(60.0, result)
コード例 #2
0
 async def setup_stream_manager(self,
                                balance=10.0,
                                fee=None,
                                old_sort=False):
     file_path = os.path.join(self.server_dir, "test_file")
     with open(file_path, 'wb') as f:
         f.write(os.urandom(20000000))
     descriptor = await StreamDescriptor.create_stream(
         self.loop,
         self.server_blob_manager.blob_dir,
         file_path,
         old_sort=old_sort)
     self.sd_hash = descriptor.sd_hash
     self.mock_wallet, self.uri = await get_mock_wallet(
         self.sd_hash, self.client_storage, self.client_wallet_dir, balance,
         fee)
     analytics_manager = AnalyticsManager(
         self.client_config,
         binascii.hexlify(generate_id()).decode(),
         binascii.hexlify(generate_id()).decode())
     self.stream_manager = StreamManager(
         self.loop, self.client_config, self.client_blob_manager,
         self.mock_wallet, self.client_storage,
         get_mock_node(self.server_from_client), analytics_manager)
     self.file_manager = FileManager(self.loop, self.client_config,
                                     self.mock_wallet, self.client_storage,
                                     analytics_manager)
     self.file_manager.source_managers['stream'] = self.stream_manager
     self.exchange_rate_manager = get_fake_exchange_rate_manager()