Fix tests and add tests for validate API method