def test_bech32_validation(self): btc = BitcoinBlockchain() result = btc.validate( 'an83characterlonghumanreadablepartthatcontainsthenumber1andtheexcludedcharactersbio1tt5tgs' ) self.assertIsInstance(result, ValidationResult) self.assertTrue(result.has_checksum())
def validator(self): return Bech32Validator(BitcoinBlockchain())
def test_bech32_address_from_test_net(self): btc = BitcoinBlockchain() result = btc.validate('tb1qw508d6qejxtdg4y5r3zarvary0c5xw7kxpjzsx') self.assertEqual(result.network_name(), BitcoinBlockchain.TEST_NET) self.assertFalse(result.is_from_main_net())
def test_bech32_address_from_main_net(self): btc = BitcoinBlockchain() result = btc.validate('bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4') self.assertEqual(result.network_name(), BitcoinBlockchain.MAIN_NET) self.assertTrue(result.is_from_main_net())
def test_is_valid_failure(self): btc = BitcoinBlockchain() result, details = btc.is_valid('lorem ipsum') self.assertFalse(result) self.assertIsInstance(details, FailedValidation)
def test_is_valid_success(self): btc = BitcoinBlockchain() result, details = btc.is_valid('1MmErJTQpfs5dHC1bTLpGqFM34MqXCaC5r') self.assertTrue(result) self.assertIsInstance(details, ValidationResult)
def test_base58check_validation(self): btc = BitcoinBlockchain() result = btc.validate('1MmErJTQpfs5dHC1bTLpGqFM34MqXCaC5r') self.assertIsInstance(result, ValidationResult) self.assertTrue(result.has_checksum())
def validator(self): return Base58CheckValidator(BitcoinBlockchain())