Test lock and unlock