add unit test for build_env method