API tests: Fixing intermittent test failure