Add unittest to functional tests and more fully spec out tests