Part of tests are refactored

More files refactored. Will fix other later (maybe tomorrow).

The non-standard invocations are not touched, it might be possible to make e.g. `test_send_failed()`, but  probably they are not often enough to require own function.

The patch is submitted under MIT License