Affiliates tests refactoring
Merge pull request #46 from bebef1987/rerwite

part1 of rewrite