#NEWLINE# def testLoadFromByteString( self ) : #NEWLINE# #INDENT# 'Test LoadFromByteString().' #NEWLINE# self . x . Reset ( ) #NEWLINE# base_cert = self . x . _cert #NEWLINE# self . mox . StubOutWithMock ( x509 . der_decoder , 'decode' , True ) #NEWLINE# self . mox . StubOutWithMock ( self . x , '_GetCertSequencesFromTopSequence' ) #NEWLINE# self . mox . StubOutWithMock ( self . x , '_GetPublicKeyFromByteString' ) #NEWLINE# self . mox . StubOutWithMock ( self . x , 'Reset' ) #NEWLINE# bytes = 'bytes' #NEWLINE# seq = 'seq' #NEWLINE# certseq = { #NEWLINE# #INDENT# 'certseq' : 1 , #NEWLINE# #UNINDENT# } #NEWLINE# pubkey = { #NEWLINE# #INDENT# 'pubkey' : 1 , #NEWLINE# #UNINDENT# } #NEWLINE# cert = { #NEWLINE# #INDENT# 'entire_byte_string' : bytes , #NEWLINE# #UNINDENT# } #NEWLINE# cert . update ( base_cert ) #NEWLINE# cert . update ( certseq ) #NEWLINE# cert . update ( pubkey ) #NEWLINE# x509 . der_decoder . decode ( bytes ) . AndReturn ( seq ) #NEWLINE# self . x . _GetCertSequencesFromTopSequence ( seq ) . AndReturn ( certseq ) #NEWLINE# self . x . _GetPublicKeyFromByteString ( bytes ) . AndReturn ( pubkey ) #NEWLINE# self . x . Reset ( ) . AndReturn ( None ) #NEWLINE# self . mox . ReplayAll ( ) #NEWLINE# self . x . LoadFromByteString ( bytes ) #NEWLINE# self . assertEqual ( self . x . _cert , cert ) #NEWLINE# self . mox . VerifyAll ( )