How to align training and test set when using pandas `get_dummies` with `drop_first=True`?
When not using drop_first=True you have two options:

Perform the one-hot encoding before splitting the data in training and test set. (Or combine the data sets, perform the one-hot encoding, and split the data sets again).
Align the data sets after one-hot encoding: an inner join removes the features that are not present in one of the sets (they would be useless anyway). train, test = train.align(test, join='inner', axis=1)

You noted (correctly) that method 2 may not do what you expect because you are using drop_first=True. So you are left with method 1.
I have a data set from telecom company having lots of categorical features. I used the pandas.get_dummies method to convert them into one hot encoded format with drop_first=True option. Now how can I use the predict function, test input data needs to be encoded in the same way, as the drop_first=True option also dropped some columns, how can I ensure that encoding takes place in similar fashion. 
Data set shape before encoding : (7043, 21)
Data set shape after encoding : (7043, 31)