Fixing analysis warnings, deprecated use of unittest/mock