def testAddDiverseNodeBulk(self):
    num_nodes = 9
    (node_list, key_map) = self._SetupNodeBulk(
        num_nodes, self._GetNewNumberedNode)

    backend.AddNodeSshKeyBulk(node_list,
                              self._potential_master_candidates,
                              pub_key_file=self._pub_key_file,
                              ssconf_store=self._ssconf_mock,
                              noded_cert_file=self.noded_cert_file,
                              run_cmd_fn=self._run_cmd_mock)

    for node_info in node_list:
      if node_info.to_authorized_keys:
        self._ssh_file_manager.AssertAllNodesHaveAuthorizedKey(
            key_map[node_info.name])
      else:
        self._ssh_file_manager.AssertNoNodeHasAuthorizedKey(
            key_map[node_info.name])
      if node_info.to_public_keys:
        self._ssh_file_manager.AssertPotentialMasterCandidatesOnlyHavePublicKey(
            node_info.name)
      else:
        self._ssh_file_manager.AssertNoNodeHasPublicKey(
            node_info.uuid, key_map[node_info.name])
Tests adding keys of several nodes with several qualities.
dataset/ETHPy150Open ganeti/ganeti/test/py/ganeti.backend_unittest.py/TestAddRemoveGenerateNodeSshKey.testAddDiverseNodeBulk