Shouldn't redo URI encoding
This commit is contained in:
parent
8ad7a5a085
commit
09154fdf20
|
@ -43,7 +43,7 @@ class TestUtil(unittest.TestCase):
|
||||||
self._do_test_parse_URI('bitcoin:15mKKb2eos1hWa6tisdPwwDC1a5J1y9nma?amount=0.0003', '15mKKb2eos1hWa6tisdPwwDC1a5J1y9nma', 30000, '', '', '')
|
self._do_test_parse_URI('bitcoin:15mKKb2eos1hWa6tisdPwwDC1a5J1y9nma?amount=0.0003', '15mKKb2eos1hWa6tisdPwwDC1a5J1y9nma', 30000, '', '', '')
|
||||||
|
|
||||||
def test_parse_URI_address_request_url(self):
|
def test_parse_URI_address_request_url(self):
|
||||||
self._do_test_parse_URI('bitcoin:15mKKb2eos1hWa6tisdPwwDC1a5J1y9nma?r=http://domain.tld/page?h%3D2a8628fc2fbe', '15mKKb2eos1hWa6tisdPwwDC1a5J1y9nma', '', '', '', 'http://domain.tld/page?h%3D2a8628fc2fbe')
|
self._do_test_parse_URI('bitcoin:15mKKb2eos1hWa6tisdPwwDC1a5J1y9nma?r=http://domain.tld/page?h%3D2a8628fc2fbe', '15mKKb2eos1hWa6tisdPwwDC1a5J1y9nma', '', '', '', 'http://domain.tld/page?h=2a8628fc2fbe')
|
||||||
|
|
||||||
def test_parse_URI_ignore_args(self):
|
def test_parse_URI_ignore_args(self):
|
||||||
self._do_test_parse_URI('bitcoin:15mKKb2eos1hWa6tisdPwwDC1a5J1y9nma?test=test', '15mKKb2eos1hWa6tisdPwwDC1a5J1y9nma', '', '', '', '')
|
self._do_test_parse_URI('bitcoin:15mKKb2eos1hWa6tisdPwwDC1a5J1y9nma?test=test', '15mKKb2eos1hWa6tisdPwwDC1a5J1y9nma', '', '', '', '')
|
||||||
|
@ -52,7 +52,7 @@ class TestUtil(unittest.TestCase):
|
||||||
self._do_test_parse_URI('bitcoin:15mKKb2eos1hWa6tisdPwwDC1a5J1y9nma?amount=0.00004&label=electrum-test&message=electrum%20test&test=none&r=http://domain.tld/page', '15mKKb2eos1hWa6tisdPwwDC1a5J1y9nma', 4000, 'electrum-test', 'electrum test', 'http://domain.tld/page')
|
self._do_test_parse_URI('bitcoin:15mKKb2eos1hWa6tisdPwwDC1a5J1y9nma?amount=0.00004&label=electrum-test&message=electrum%20test&test=none&r=http://domain.tld/page', '15mKKb2eos1hWa6tisdPwwDC1a5J1y9nma', 4000, 'electrum-test', 'electrum test', 'http://domain.tld/page')
|
||||||
|
|
||||||
def test_parse_URI_no_address_request_url(self):
|
def test_parse_URI_no_address_request_url(self):
|
||||||
self._do_test_parse_URI('bitcoin:?r=http://domain.tld/page?h%3D2a8628fc2fbe', '', '', '', '', 'http://domain.tld/page?h%3D2a8628fc2fbe')
|
self._do_test_parse_URI('bitcoin:?r=http://domain.tld/page?h%3D2a8628fc2fbe', '', '', '', '', 'http://domain.tld/page?h=2a8628fc2fbe')
|
||||||
|
|
||||||
def test_parse_URI_invalid_address(self):
|
def test_parse_URI_invalid_address(self):
|
||||||
self.assertRaises(AssertionError, parse_URI, 'bitcoin:invalidaddress')
|
self.assertRaises(AssertionError, parse_URI, 'bitcoin:invalidaddress')
|
||||||
|
|
|
@ -159,7 +159,6 @@ def age(from_date, since_date = None, target_tz=None, include_seconds=False):
|
||||||
|
|
||||||
def parse_URI(uri):
|
def parse_URI(uri):
|
||||||
import urlparse
|
import urlparse
|
||||||
import urllib
|
|
||||||
import bitcoin
|
import bitcoin
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
|
|
||||||
|
@ -193,7 +192,7 @@ def parse_URI(uri):
|
||||||
if 'label' in pq:
|
if 'label' in pq:
|
||||||
label = pq['label'][0]
|
label = pq['label'][0]
|
||||||
if 'r' in pq:
|
if 'r' in pq:
|
||||||
request_url = urllib.quote(pq['r'][0], '/:?')
|
request_url = pq['r'][0]
|
||||||
|
|
||||||
if request_url != '':
|
if request_url != '':
|
||||||
return address, amount, label, message, request_url
|
return address, amount, label, message, request_url
|
||||||
|
|
Loading…
Reference in New Issue