rewrite tests using unittest