Refactor delay_between_attempts tests

Factor out create_and_check function that works
supports all the tests.