Pregnancy tests

Can you take a pregnancy test 2 weeks after unprotected sex or do you have to wait longer.🤗