Refactor IAM S3 tests.