Bunch more invitation tests

Also added invitation id hashing. Resolves issue #191