Beispiel #1
0
 def test_msp_secrets_cryptogen(self, mock_cacerts_to_secrets,
                                mock_copy_secret, mock_glob,
                                mock_id_to_secrets):
     mock_glob.side_effect = [[
         "./crypto/crypto-config/ordererOrganizations/msp-ns.domain/users/[email protected]/msp"
     ]]
     opts = deepcopy(self.OPTS)
     opts["cas"] = {}
     msp_secrets(opts, "a_MSP")
     mock_glob.assert_called_once_with(
         "./crypto/crypto-config/*Organizations/msp-ns*/users/Admin*/msp")
     mock_copy_secret.assert_called_once_with(
         "./crypto/crypto-config/ordererOrganizations/msp-ns.domain/users/[email protected]/msp/signcerts",
         "./crypto/crypto-config/ordererOrganizations/msp-ns.domain/users/[email protected]/msp/admincerts",
     )
     mock_cacerts_to_secrets.assert_called_once_with(
         "msp-ns",
         "./crypto/crypto-config/ordererOrganizations/msp-ns.domain/users/[email protected]/msp",
         "an-admin",
         verbose=False,
     )
     mock_id_to_secrets.assert_called_once_with(
         "msp-ns",
         "./crypto/crypto-config/ordererOrganizations/msp-ns.domain/users/[email protected]/msp",
         "an-admin",
         verbose=False,
     )
Beispiel #2
0
 def test_msp_secrets(self, mock_cacerts_to_secrets, mock_id_to_secrets, mock_makedirs, mock_shutil):
     msp_secrets(self.OPTS, 'a_MSP')
     mock_makedirs.assert_called_once_with('./a_dir/a_MSP/admincerts')
     mock_shutil.copy.assert_called_once_with('./a_dir/a_MSP/signcerts/cert.pem', './a_dir/a_MSP/admincerts/cert.pem')
     mock_cacerts_to_secrets.assert_called_once_with(
         'msp-namespace', './a_dir/a_MSP', 'an-admin', verbose=False)
     mock_id_to_secrets.assert_called_once_with(
         'msp-namespace', './a_dir/a_MSP', 'an-admin', verbose=False)
Beispiel #3
0
 def test_msp_secrets(self, mock_cacerts_to_secrets, mock_copy_secret,
                      mock_glob, mock_id_to_secrets):
     opts = deepcopy(self.OPTS)
     msp_secrets(opts, "a_MSP")
     mock_glob.assert_not_called()
     mock_copy_secret.assert_called_once_with("./crypto/a_MSP/signcerts",
                                              "./crypto/a_MSP/admincerts")
     mock_cacerts_to_secrets.assert_called_once_with(
         "msp-ns", "./crypto/a_MSP", "an-admin")
     mock_id_to_secrets.assert_called_once_with("msp-ns", "./crypto/a_MSP",
                                                "an-admin")
Beispiel #4
0
 def test_msp_secrets_cryptogen_fail(self, mock_cacerts_to_secrets,
                                     mock_copy_secret, mock_glob,
                                     mock_id_to_secrets):
     mock_glob.side_effect = [[
         "./crypto/crypto-config/ordererOrganizations/msp-ns.domain/users/[email protected]/msp",
         "./crypto/crypto-config/peerOrganizations/msp-ns.domain/users/[email protected]/msp",
     ]]
     opts = deepcopy(self.OPTS)
     opts["cas"] = {}
     with pytest.raises(ValueError):
         msp_secrets(opts, "a_MSP")
     mock_glob.assert_called_once_with(
         "./crypto/crypto-config/*Organizations/msp-ns*/users/Admin*/msp")
     mock_copy_secret.assert_not_called()
     mock_cacerts_to_secrets.assert_not_called()
     mock_id_to_secrets.assert_not_called()