(#20677) Add tests to ensure configuration errors are raised as expected

I also took the liberty of adding a add_raw_stanza helper function. It
doesn't really do much, but it seems like a good idea to me to keep the specs
as clean as possible. Maybe having two separate cases for allow &
allow_ip is a bit overzealous, but I guess the overhead is minimal.