Fix bug 1044096: Make SignedAgreements unique by user/agreement pair.

Let me know if you want any stylistic changes (like better isolation in the tests).