'Test update_live_symlinks'

def test_update_live_symlinks(self):

    from certbot import cert_manager
    archive_paths = {}
    for domain in self.domains:
        custom_archive = self.domains[domain]
        if (custom_archive is not None):
            archive_dir_path = custom_archive
        else:
            archive_dir_path = os.path.join(self.config.default_archive_dir, domain)
        archive_paths[domain] = dict(((kind, os.path.join(archive_dir_path, (kind + '1.pem'))) for kind in ALL_FOUR))
        for kind in ALL_FOUR:
            live_path = self.config_files[domain][kind]
            archive_path = archive_paths[domain][kind]
            open(archive_path, 'a').close()
            os.symlink(os.path.join(self.config.config_dir, (kind + '1.pem')), live_path)
    cert_manager.update_live_symlinks(self.config)
    prev_dir = os.getcwd()
    try:
        for domain in self.domains:
            for kind in ALL_FOUR:
                os.chdir(os.path.dirname(self.config_files[domain][kind]))
                self.assertEqual(os.path.realpath(os.readlink(self.config_files[domain][kind])), os.path.realpath(archive_paths[domain][kind]))
    finally:
        os.chdir(prev_dir)
