refactor deployment module and unittest