pytest:gkdi: shift create_root_key into a function