def testUpdate(self):
    data = {constants.SSHS_SSH_ROOT_KEY: [(constants.SSHK_DSA, 'privatedsa', 'ssh-dss pubdsa')], constants.SSHS_SSH_KEY_TYPE: 'dsa', constants.SSHS_SSH_KEY_BITS: 1024}
    prepare_node_join.UpdateSshRoot(data, False, _homedir_fn=self._GetHomeDir)
    self.assertEqual(os.listdir(self.tmpdir), ['.ssh'])
    self.assertEqual(sorted(os.listdir(self.sshdir)), sorted(['authorized_keys', 'id_dsa', 'id_dsa.pub']))
    self.assertTrue((utils.ReadFile(utils.PathJoin(self.sshdir, 'id_dsa')) is not None))
    pub_key = utils.ReadFile(utils.PathJoin(self.sshdir, 'id_dsa.pub'))
    self.assertTrue((pub_key is not None))
    self.assertEquals(utils.ReadFile(utils.PathJoin(self.sshdir, 'authorized_keys')), pub_key)
def testUpdate(self):
    data = {constants.SSHS_SSH_ROOT_KEY: [(constants.SSHK_DSA, 'privatedsa', 'ssh-dss pubdsa')], constants.SSHS_SSH_KEY_TYPE: 'dsa', constants.SSHS_SSH_KEY_BITS: 1024}
    prepare_node_join.UpdateSshRoot(data, False, _homedir_fn=self._GetHomeDir)
    self.assertEqual(os.listdir(self.tmpdir), ['.ssh'])
    self.assertEqual(sorted(os.listdir(self.sshdir)), sorted(['authorized_keys', 'id_dsa', 'id_dsa.pub']))
    self.assertTrue((utils.ReadFile(utils.PathJoin(self.sshdir, 'id_dsa')) is not None))
    pub_key = utils.ReadFile(utils.PathJoin(self.sshdir, 'id_dsa.pub'))
    self.assertTrue((pub_key is not None))
    self.assertEquals(utils.ReadFile(utils.PathJoin(self.sshdir, 'authorized_keys')), pub_key)