How to test for a condition only if another test passes?