I think in general, it makes a test brittle, but what you need to test here is that there is an exception raised saying you are missing a password.  That's why I suggested a regexp around "password" and "required".