def test_user_id_partition_keygen_raise_error_when_context_null(self): with self.assertRaises(PersistenceException) as exc: user_id_partition_keygen(request_envelope=self.request_envelope) assert "Couldn't retrieve user id from request envelope" in str( exc.exception), ( "User Id Partition Key Generation didn't throw exception when " "null context provided in request envelope")
def test_valid_user_id_partition_keygen(self): self.user.user_id = "123" self.system.user = self.user self.context.system = self.system self.request_envelope.context = self.context assert user_id_partition_keygen(self.request_envelope) == "123", ( "User Id Partition Key Generation retrieved wrong user id from " "valid request envelope")