def test_blocks( self, mock_get_msps, mock_is_orderer_msp, mock_chdir, mock_execute, mock_exists, mock_log, mock_secret_from_files, ): mock_exists.side_effect = [False, False] mock_get_msps.side_effect = [["AlphaMSP", "BetaMSP"]] mock_is_orderer_msp.side_effect = [True, False] genesis_block(self.OPTS) mock_chdir.assert_has_calls([call("./config"), call(PWD)]) mock_exists.assert_called_once_with("./crypto/genesis.block") mock_get_msps.assert_called_once_with(opts=self.OPTS) mock_is_orderer_msp.assert_has_calls([ call(opts=self.OPTS, msp="AlphaMSP"), call(opts=self.OPTS, msp="BetaMSP") ]) mock_execute.assert_called_once_with( "configtxgen -profile OrdererGenesis -outputBlock ./crypto/genesis.block" ) mock_log.info.assert_not_called() mock_secret_from_files.assert_called_once_with( secret="a-genesis-secret", namespace="ord-ns", keys_files_path={"genesis.block": "./crypto/genesis.block"}, )
def crypto(ctx): # pragma: no cover opts = load_config(ctx.obj['settings_file']) # Set up Admin MSPs admin_msp(opts, opts['orderers']['msp'], verbose=ctx.obj['verbose']) admin_msp(opts, opts['peers']['msp'], verbose=ctx.obj['verbose']) # Genesis & Channel genesis_block(opts, verbose=ctx.obj['verbose']) channel_tx(opts, verbose=ctx.obj['verbose']) # Setup node MSPs setup_nodes(opts, 'orderer', verbose=ctx.obj['verbose']) setup_nodes(opts, 'peer', verbose=ctx.obj['verbose'])
def test_again(self, mock_chdir, mock_execute, mock_path, mock_print, mock_secret_from_file): mock_path.exists.side_effect = [True, True] genesis_block(self.OPTS, True) mock_chdir.assert_has_calls([ call('./a_dir'), call(PWD) ]) mock_path.exists.assert_called_once_with('genesis.block') mock_execute.assert_not_called() mock_print.assert_called_once_with('genesis.block already exists') mock_secret_from_file.assert_called_once_with( secret='a-genesis-secret', namespace='ord-namespace', key='genesis.block', filename='genesis.block', verbose=True)
def test_again(self, mock_chdir, mock_execute, mock_exists, mock_log, mock_secret_from_files): mock_exists.side_effect = [True, True] genesis_block(self.OPTS) mock_chdir.assert_has_calls([call("./config"), call(PWD)]) mock_exists.assert_called_once_with("./crypto/genesis.block") mock_execute.assert_not_called() mock_log.info.assert_called_once_with( "./crypto/genesis.block already exists") mock_secret_from_files.assert_called_once_with( secret="a-genesis-secret", namespace="ord-ns", keys_files_path={"genesis.block": "./crypto/genesis.block"}, )
def test_blocks(self, mock_chdir, mock_execute, mock_path, mock_print, mock_secret_from_file): mock_path.exists.side_effect = [False, False] genesis_block(self.OPTS) mock_chdir.assert_has_calls([ call('./a_dir'), call(PWD) ]) mock_path.exists.assert_called_once_with('genesis.block') mock_execute.assert_called_once_with( 'configtxgen -profile OrdererGenesis -outputBlock genesis.block', verbose=False) mock_print.assert_not_called() mock_secret_from_file.assert_called_once_with( secret='a-genesis-secret', namespace='ord-namespace', key='genesis.block', filename='genesis.block', verbose=False)
def test_again(self, mock_chdir, mock_execute, mock_exists, mock_print, mock_secret_from_file): mock_exists.side_effect = [True, True] genesis_block(self.OPTS, True) mock_chdir.assert_has_calls([call("./config"), call(PWD)]) mock_exists.assert_called_once_with("./crypto/genesis.block") mock_execute.assert_not_called() mock_print.assert_called_once_with( "./crypto/genesis.block already exists") mock_secret_from_file.assert_called_once_with( secret="a-genesis-secret", namespace="ord-ns", key="genesis.block", filename="./crypto/genesis.block", verbose=True, )
def runner_crypto(opts): """Create Crypto-material by either using CAs or save Cryptogen material. Args: opts (dict): Nephos options dict. """ # Set up Admin MSPs for msp in get_msps(opts=opts): admin_msp(opts, msp) # Genesis & Channel genesis_block(opts) # TODO: We currently only support a single channel channel_tx(opts) # Setup node MSPs setup_nodes(opts)
def fabric(ctx): # pragma: no cover opts = load_config(ctx.obj['settings_file']) # Setup CA setup_ca(opts, upgrade=ctx.obj['upgrade'], verbose=ctx.obj['verbose']) # Crypto material admin_msp(opts, opts['orderers']['msp'], verbose=ctx.obj['verbose']) admin_msp(opts, opts['peers']['msp'], verbose=ctx.obj['verbose']) genesis_block(opts, verbose=ctx.obj['verbose']) channel_tx(opts, verbose=ctx.obj['verbose']) setup_nodes(opts, 'orderer', verbose=ctx.obj['verbose']) setup_nodes(opts, 'peer', verbose=ctx.obj['verbose']) # Orderers setup_ord(opts, upgrade=ctx.obj['upgrade'], verbose=ctx.obj['verbose']) # Peers setup_peer(opts, upgrade=ctx.obj['upgrade'], verbose=ctx.obj['verbose']) setup_channel(opts, verbose=ctx.obj['verbose'])
def test_blocks(self, mock_chdir, mock_execute, mock_exists, mock_print, mock_secret_from_file): mock_exists.side_effect = [False, False] genesis_block(self.OPTS) mock_chdir.assert_has_calls([call("./config"), call(PWD)]) mock_exists.assert_called_once_with("./crypto/genesis.block") mock_execute.assert_called_once_with( "configtxgen -profile OrdererGenesis -outputBlock ./crypto/genesis.block", verbose=False, ) mock_print.assert_not_called() mock_secret_from_file.assert_called_once_with( secret="a-genesis-secret", namespace="ord-ns", key="genesis.block", filename="./crypto/genesis.block", verbose=False, )
def runner_crypto(opts, verbose=False): """Create Crypto-material by either using CAs or save Cryptogen material. Args: opts (dict): Nephos options dict. verbose (bool): Verbosity. False by default. """ # TODO: Limited by the fact that we manually specify MSPs # Set up Admin MSPs admin_msp(opts, opts["orderers"]["msp"], verbose=verbose) admin_msp(opts, opts["peers"]["msp"], verbose=verbose) # Genesis & Channel genesis_block(opts, verbose=verbose) # TODO: We currently only support a single channel channel_tx(opts, verbose=verbose) # Setup node MSPs setup_nodes(opts, "orderer", verbose=verbose) setup_nodes(opts, "peer", verbose=verbose)