'Look for mode=setup_needed in checkid_immediate negative
response in OpenID 2 case.
See specification Responding to Authentication Requests /
Negative Assertions / In Response to Immediate Requests.'

def test_answerImmediateDenyOpenID2(self):

    self.request.mode = 'checkid_immediate'
    self.request.immediate = True
    self.request.claimed_id = 'http://claimed-id.test/'
    server_url = 'http://setup-url.unittest/'
    answer = self.request.answer(False, server_url=server_url)
    self.failUnlessEqual(answer.request, self.request)
    self.failUnlessEqual(len(answer.fields.toPostArgs()), 3, answer.fields)
    self.failUnlessEqual(answer.fields.getOpenIDNamespace(), OPENID2_NS)
    self.failUnlessEqual(answer.fields.getArg(OPENID_NS, 'mode'), 'setup_needed')
    usu = answer.fields.getArg(OPENID_NS, 'user_setup_url')
    expected_substr = 'openid.claimed_id=http%3A%2F%2Fclaimed-id.test%2F'
    self.failUnless((expected_substr in usu), usu)
