fix fee tests, whitespace

This commit is contained in:
Jack Robison 2017-04-12 17:42:55 -04:00
parent 4698910ab7
commit e6f92a2dc7
2 changed files with 26 additions and 27 deletions

View file

@ -846,7 +846,7 @@ class Daemon(AuthJSONRPCServer):
resolved = yield self.session.wallet.resolve_uri(uri) resolved = yield self.session.wallet.resolve_uri(uri)
if 'claim' in resolved: if 'claim' in resolved:
claim = ClaimDict.deserialize(resolved['claim']['hex'].decode('hex')) claim = ClaimDict.load_dict(resolved['claim']['value'])
final_fee = self._add_key_fee_to_est_data_cost(claim.source_fee, cost) final_fee = self._add_key_fee_to_est_data_cost(claim.source_fee, cost)
result = yield self._render_response(final_fee) result = yield self._render_response(final_fee)
defer.returnValue(result) defer.returnValue(result)
@ -1483,23 +1483,23 @@ class Daemon(AuthJSONRPCServer):
If uri resolves to a channel: If uri resolves to a channel:
'claims_in_channel': [ 'claims_in_channel': [
{ {
'address': (str) claim address, 'address': (str) claim address,
'amount': (float) claim amount, 'amount': (float) claim amount,
'effective_amount': (float) claim amount including supports, 'effective_amount': (float) claim amount including supports,
'claim_id': (str) claim id, 'claim_id': (str) claim id,
'claim_sequence': (int) claim sequence number, 'claim_sequence': (int) claim sequence number,
'decoded_claim': (bool) whether or not the claim value was decoded, 'decoded_claim': (bool) whether or not the claim value was decoded,
'height': (int) claim height, 'height': (int) claim height,
'depth': (int) claim depth, 'depth': (int) claim depth,
'has_signature': (bool) included if decoded_claim 'has_signature': (bool) included if decoded_claim
'name': (str) claim name, 'name': (str) claim name,
'supports: (list) list of supports [{'txid': txid, 'supports: (list) list of supports [{'txid': txid,
'nout': nout, 'nout': nout,
'amount': amount}], 'amount': amount}],
'txid': (str) claim txid, 'txid': (str) claim txid,
'nout': (str) claim nout, 'nout': (str) claim nout,
'signature_is_valid': (bool), included if has_signature, 'signature_is_valid': (bool), included if has_signature,
'value': ClaimDict if decoded, otherwise hex string 'value': ClaimDict if decoded, otherwise hex string
} }
] ]
If uri resolves to a claim: If uri resolves to a claim:
@ -1546,7 +1546,6 @@ class Daemon(AuthJSONRPCServer):
'download_directory'(optional): (str) path to directory where file will be saved 'download_directory'(optional): (str) path to directory where file will be saved
Returns: Returns:
(dict) Dictionary contaning information about the stream (dict) Dictionary contaning information about the stream
{ {
'completed': (bool) true if download is completed, 'completed': (bool) true if download is completed,
'file_name': (str) name of file, 'file_name': (str) name of file,
@ -1554,7 +1553,7 @@ class Daemon(AuthJSONRPCServer):
'points_paid': (float) credit paid to download file, 'points_paid': (float) credit paid to download file,
'stopped': (bool) true if download is stopped, 'stopped': (bool) true if download is stopped,
'stream_hash': (str) stream hash of file, 'stream_hash': (str) stream hash of file,
'stream_name': (str) stream name , 'stream_name': (str) stream name,
'suggested_file_name': (str) suggested file name, 'suggested_file_name': (str) suggested file name,
'sd_hash': (str) sd hash of file, 'sd_hash': (str) sd hash of file,
'name': (str) name claim attached to file 'name': (str) name claim attached to file
@ -1568,7 +1567,6 @@ class Daemon(AuthJSONRPCServer):
'message': (str), None if full_status is false 'message': (str), None if full_status is false
'metadata': (dict) Metadata dictionary 'metadata': (dict) Metadata dictionary
} }
""" """
timeout = timeout if timeout is not None else self.download_timeout timeout = timeout if timeout is not None else self.download_timeout

View file

@ -86,7 +86,8 @@ def get_test_daemon(data_rate=None, generous=True, with_fee=False):
metadata.update( metadata.update(
{"fee": {"USD": {"address": "bQ6BGboPV2SpTMEP7wLNiAcnsZiH8ye6eA", "amount": 0.75}}}) {"fee": {"USD": {"address": "bQ6BGboPV2SpTMEP7wLNiAcnsZiH8ye6eA", "amount": 0.75}}})
daemon._resolve_name = lambda _: defer.succeed(metadata) daemon._resolve_name = lambda _: defer.succeed(metadata)
daemon.session.wallet.resolve_uri = lambda _: defer.succeed(smart_decode(json.dumps(metadata))) migrated = smart_decode(json.dumps(metadata))
daemon.session.wallet.resolve_uri = lambda _: defer.succeed({'claim': {'value': migrated.claim_dict}})
return daemon return daemon