Refactor tests. Uses unittest module features. Uses Mock library.