Add unit tests for keystore and cb script