This is a bit of a strange test. The key is purged from the enforcer database, but fails because the key does not exist in the HSM. It would be nicer to push a the auto-generated ZSK to retire and dead and then purge that, but that will be a little more work... So maybe add a comment to explain why this fails and a TODO about improving the test in future.

I think you should also then test that the key is no longer in the output of 'key list' with another check after the purge.

Otherwise, the test looks good!