8 speed shifter with 7 speed cassette
Assuming the shifter and derailleur have compatible cable pulls (which you should check), you won't be able to perfectly adjust the shifter to shift smoothly on a cassette of 7, since the cable pull which moves the shifter for 8 speeds is likely not enough for 7 speeds. Thus, generally, you need to match the shifters with the derailleur and the cassette spacing. 

Sheldon Brown has some comments on 7 speed setups and running an 8 speed shifter with 7 speeds through some alternate cable routing, but given that you can buy an 8 speed cassette for like 10 bucks, it seems like an unnecessary hassle (given the extra time you'll be spending tweaking adjustment). Or you can bolt on a 5 buck friction shifter and save yourself some time too.