Fix template rendering in test environment