Fixed unit tests

Had to skip two tests because I don't know how to mock properly when
recursion is involved.

Also made some PEP8 fixes.