def test_prepare_regtest(self):
     testargs = [
         'coldstakepool-prepare', '--datadir=~/csp_regtest', '--regtest'
     ]
     with patch.object(sys, 'argv', testargs):
         prepareSystem.main()
     shutil.rmtree(os.path.expanduser('~/csp_regtest'))
    def test_mode_no_url(self):
        testargs = ['coldstakepool-prepare', '--mode=observer']
        with patch('sys.stderr', new=StringIO()) as fake_stderr:
            with patch.object(sys, 'argv', testargs):
                with self.assertRaises(SystemExit) as cm:
                    prepareSystem.main()

        self.assertEqual(cm.exception.code, 1)
        self.assertTrue(
            'observer mode requires configurl' in fake_stderr.getvalue())
Exemple #3
0
    def test_prepare_testnet_observer(self):
        testargs = [
            'coldstakepool-prepare', '--datadir=~/csp_testnet_obs',
            '--testnet', '--mode=observer', '--configurl=file://' +
            os.path.expanduser('~/csp_testnet/stakepool/stakepool.json')
        ]
        with patch.object(sys, 'argv', testargs):
            prepareSystem.main()

        with open(
                os.path.expanduser(
                    '~/csp_testnet_obs/stakepool/stakepool.json')) as fp:
            settings = json.load(fp)
            assert (settings['mode'] == 'observer')
Exemple #4
0
    def test_prepare(self):
        testargs = [
            'coldstakepool-prepare', '--datadir=~/csp_mainnet', '--mainnet'
        ]
        with patch.object(sys, 'argv', testargs):
            prepareSystem.main()

        # Should fail when run on existing dir
        with patch('sys.stderr', new=StringIO()) as fake_stderr:
            with patch.object(sys, 'argv', testargs):
                with self.assertRaises(SystemExit) as cm:
                    prepareSystem.main()
        self.assertEqual(cm.exception.code, 1)
        self.assertTrue('particl.conf exists' in fake_stderr.getvalue())
Exemple #5
0
 def test_prepare_regtest(self):
     testargs = [
         'coldstakepool-prepare', '--datadir=~/csp_regtest', '--regtest'
     ]
     with patch.object(sys, 'argv', testargs):
         prepareSystem.main()