That story by itself doesn’t make sense. If they were blackmailing him, threatening to reveal the affair if he didn’t resign, then why would he resign, and reveal the affair himself, and not testify on top of that? As soon as he revealed the affair, the power of their blackmail vanished, and he would have no reason not to testify.
So, I think they must have some other blackmail on him, and the affair story is just his cover for why he is resigning.
Obama's people wanted to get rid of him, and the "scandal" gives them reason to do so. That's my take anyway.