UPDATED fixed test that handles unexpected error codes.