Exemplo n.º 1
0
def test_parse_uri_bip276() -> None:
    Net.set_to(SVTestnet)
    try:
        d = parse_URI(BIP276_URI)
    finally:
        Net.set_to(SVMainnet)

    expected_message = "the money i owe you"
    assert d == {
        "bip276": BIP276_TEXT,
        "script": BIP276_DATA,
        "amount": 12112121,
        "message": expected_message,
        "memo": expected_message,
    }
Exemplo n.º 2
0
 def _do_test_parse_URI(self, uri, expected):
     result = parse_URI(uri)
     self.assertEqual(expected, result)
Exemplo n.º 3
0
def _do_test_parse_URI(uri, expected):
    result = parse_URI(uri)
    assert expected == result
Exemplo n.º 4
0
def test_fail_bitcoincash():
    with pytest.raises(URIError):
        parse_URI(
            'bitcoincash:15mKKb2eos1hWa6tisdPwwDC1a5J1y9nma?label=electrum%20test'
        )
Exemplo n.º 5
0
def test_parse_URI_parameter_duplication():
    with pytest.raises(URIError):
        parse_URI('bitcoin:15mKKb2eos1hWa6tisdPwwDC1a5J1y9nma?amount=0.0003&'
                  'label=test&amount=30.0')
Exemplo n.º 6
0
def test_parse_URI_invalid():
    with pytest.raises(URIError):
        parse_URI('notbitcoin:15mKKb2eos1hWa6tisdPwwDC1a5J1y9nma')
Exemplo n.º 7
0
def test_parse_URI_invalid_address():
    with pytest.raises(URIError):
        parse_URI('bitcoin:invalidaddress')