'Test that the overridden request method will create history'

@mock.patch.object(requests.Session, 'request')
def test_creates_history_while_handling_2fa(self, request_mock):

    response = mock.Mock()
    response.configure_mock(status_code=401, headers={'X-GitHub-OTP': 'required;2fa'}, history=[])
    request_mock.return_value = response
    s = self.build_session()
    s.two_factor_auth_callback((lambda : 'fake'))
    r = s.get('http://example.com')
    assert (len(r.history) != 0)
    assert (request_mock.call_count == 2)
