I know if you perform some sort of transformation and you use fit() then you have to transform() both the training set and the test set.
Suppose you apply a targeted undersampling technique such as TomekLinks to your training data to allow the model to better identify\separate classes.
I don't think you should undersample your test data. While it is perfectly resonable to do it the the training data, doing it on the test data is unrealistic. If the model is intended for any online application, it needs to be tested on the real, unbalanced dataset.