Testing dark energy with supernovae