Refactor some m2m tests