The correct answer is: B. will buy

The sentence "I passed my driving test!" is in the simple past tense. This means that the action of passing the driving test has already happened. The sentence "That's great! I will buy some champagne to celebrate!" is in the future tense. This means that the action of buying the champagne will happen after the action of passing the driving test.

The other options are not correct because they do not reflect the order of events. Option A, "am going to buy," is in the present progressive tense. This tense is used to talk about actions that are happening now or that will happen in the near future. Option C, "bought," is in the simple past tense. This tense is used to talk about actions that happened in the past. Option D, "was buying," is in the past progressive tense. This tense is used to talk about actions that were happening in the past when another action happened.

In this case, the action of buying the champagne will happen after the action of passing the driving test. Therefore, the correct tense to use is the future tense.