[tests] don't override __init__() in individual tests
[bitcoinplatinum.git] / test / functional / disablewallet.py
blobc1d37963bc60527603fe2fffeaa704a40c9a3f4c
1 #!/usr/bin/env python3
2 # Copyright (c) 2015-2016 The Bitcoin Core developers
3 # Distributed under the MIT software license, see the accompanying
4 # file COPYING or http://www.opensource.org/licenses/mit-license.php.
5 """Test a node with the -disablewallet option.
7 - Test that validateaddress RPC works when running with -disablewallet
8 - Test that it is not possible to mine to an invalid address.
9 """
11 from test_framework.test_framework import BitcoinTestFramework
12 from test_framework.util import *
14 class DisableWalletTest (BitcoinTestFramework):
15 def set_test_params(self):
16 self.setup_clean_chain = True
17 self.num_nodes = 1
18 self.extra_args = [["-disablewallet"]]
20 def run_test (self):
21 # Make sure wallet is really disabled
22 assert_raises_jsonrpc(-32601, 'Method not found', self.nodes[0].getwalletinfo)
23 x = self.nodes[0].validateaddress('3J98t1WpEZ73CNmQviecrnyiWrnqRhWNLy')
24 assert(x['isvalid'] == False)
25 x = self.nodes[0].validateaddress('mneYUmWYsuk7kySiURxCi3AGxrAqZxLgPZ')
26 assert(x['isvalid'] == True)
28 # Checking mining to an address without a wallet. Generating to a valid address should succeed
29 # but generating to an invalid address will fail.
30 self.nodes[0].generatetoaddress(1, 'mneYUmWYsuk7kySiURxCi3AGxrAqZxLgPZ')
31 assert_raises_jsonrpc(-5, "Invalid address", self.nodes[0].generatetoaddress, 1, '3J98t1WpEZ73CNmQviecrnyiWrnqRhWNLy')
33 if __name__ == '__main__':
34 DisableWalletTest ().main ()