def testStep1(self):
    """Test the first step of Auth1 authentication."""
    self.mox.StubOutWithMock(self.ba, 'Nonce')
    self.mox.StubOutWithMock(self.ba, '_AssembleMessage')
    self.mox.StubOutWithMock(self.ba, 'Sign')
    self.mox.StubOutWithMock(self.ba, 'SessionSetCnSn')
    self.mox.StubOutWithMock(base.base64, 'urlsafe_b64encode')

    sn = GetRandomInt()
    cn = GetRandomInt()

    self.ba.Nonce().AndReturn(sn)
    m = '%s %s' % (cn, sn)
    self.ba._AssembleMessage(str(cn), str(sn)).AndReturn(m)
    self.ba.Sign(m).AndReturn('SIGN(%s)' % m)
    base.base64.urlsafe_b64encode('SIGN(%s)' % m).AndReturn('B64SIG')
    self.ba._AssembleMessage(m, 'B64SIG').AndReturn('%s B64SIG' % m)
    self.ba.SessionSetCnSn(cn, sn)

    self.mox.ReplayAll()
    self.AssertState(base.State.INPUT)
    self.AssertAuthState(base.AuthState.UNKNOWN)

    self.ba.Input(n=str(cn))
    self.AssertState(base.State.OUTPUT)
    self.assertEqual(self.ba.Output(), self._MakeMsg(cn, sn, 'B64SIG'))
    self.AssertState(base.State.INPUT)
    # despite the output of a signed data, we are NOT authenticated yet
    self.AssertAuthState(base.AuthState.UNKNOWN)
    self.mox.VerifyAll()
dataset/ETHPy150Open google/simian/src/tests/simian/auth/base_medium_test.py/Auth1Test.testStep1/original