<s> """<STR_LIT>""" <EOL> import logging <EOL> from google . apputils import app <EOL> from tests . simian . mac . common import test <EOL> from simian . mac . munki . handlers import manifests <EOL> class HandlersTest ( test . RequestHandlerTest ) : <EOL> def GetTestClassInstance ( self ) : <EOL> return manifests . Manifests ( ) <EOL> def GetTestClassModule ( self ) : <EOL> return manifests <EOL> def testGetSuccess ( self ) : <EOL> """<STR_LIT>""" <EOL> client_id = { '<STR_LIT>' : '<STR_LIT>' } <EOL> session = '<STR_LIT>' <EOL> plist_xml = '<STR_LIT>' <EOL> self . mox . StubOutWithMock ( manifests . handlers , '<STR_LIT>' ) <EOL> self . mox . StubOutWithMock ( manifests . common , '<STR_LIT>' ) <EOL> self . MockDoAnyAuth ( and_return = session ) <EOL> manifests . handlers . GetClientIdForRequest ( <EOL> self . request , session = session , client_id_str = '<STR_LIT>' ) . AndReturn ( client_id ) <EOL> manifests . common . GetComputerManifest ( <EOL> client_id = client_id , packagemap = False ) . AndReturn ( plist_xml ) <EOL> self . response . headers [ '<STR_LIT:Content-Type>' ] = '<STR_LIT>' <EOL> self . response . out . write ( plist_xml ) . AndReturn ( None ) <EOL> self . mox . ReplayAll ( ) <EOL> self . c . get ( ) <EOL> self . mox . VerifyAll ( ) <EOL> def testGetSuccessWhenManifestNotFoundError ( self ) : <EOL> """<STR_LIT>""" <EOL> client_id = { '<STR_LIT>' : '<STR_LIT>' } <EOL> session = '<STR_LIT>' <EOL> self . mox . StubOutWithMock ( manifests . handlers , '<STR_LIT>' ) <EOL> self . mox . StubOutWithMock ( manifests . common , '<STR_LIT>' ) <EOL> self . MockDoAnyAuth ( and_return = session ) <EOL> manifests . handlers . GetClientIdForRequest ( <EOL> self . request , session = session , client_id_str = '<STR_LIT>' ) . AndReturn ( client_id ) <EOL> manifests . common . GetComputerManifest ( <EOL> client_id = client_id , packagemap = False ) . AndRaise ( <EOL> manifests . common . ManifestNotFoundError ) <EOL> self . response . set_status ( <NUM_LIT> ) . AndReturn ( None ) <EOL> self . mox . ReplayAll ( ) <EOL> self . c . get ( ) <EOL> self . mox . VerifyAll ( ) <EOL> def testGetSuccessWhenManifestDisabledError ( self ) : <EOL> """<STR_LIT>""" <EOL> client_id = { '<STR_LIT>' : '<STR_LIT>' } <EOL> session = '<STR_LIT>' <EOL> self . mox . StubOutWithMock ( manifests . handlers , '<STR_LIT>' ) <EOL> self . mox . StubOutWithMock ( manifests . common , '<STR_LIT>' ) <EOL> self . MockDoAnyAuth ( and_return = session ) <EOL> manifests . handlers . GetClientIdForRequest ( <EOL> self . request , session = session , client_id_str = '<STR_LIT>' ) . AndReturn ( client_id ) <EOL> manifests . common . GetComputerManifest ( <EOL> client_id = client_id , packagemap = False ) . AndRaise ( <EOL> manifests . common . ManifestDisabledError ) <EOL> self . response . set_status ( <NUM_LIT> ) . AndReturn ( None ) <EOL> self . mox . ReplayAll ( ) <EOL> self . c . get ( ) <EOL> self . mox . VerifyAll ( ) <EOL> def testGetSuccessWhenOtherManifestError ( self ) : <EOL> """<STR_LIT>""" <EOL> client_id = { '<STR_LIT>' : '<STR_LIT>' } <EOL> session = '<STR_LIT>' <EOL> self . mox . StubOutWithMock ( manifests . handlers , '<STR_LIT>' ) <EOL> self . mox . StubOutWithMock ( manifests . common , '<STR_LIT>' ) <EOL> self . MockDoAnyAuth ( and_return = session ) <EOL> manifests . handlers . GetClientIdForRequest ( <EOL> self . request , session = session , client_id_str = '<STR_LIT>' ) . AndReturn ( client_id ) <EOL> manifests . common . GetComputerManifest ( <EOL> client_id = client_id , packagemap = False ) . AndRaise ( <EOL> manifests . common . Error ) <EOL> self . response . set_status ( <NUM_LIT> ) . AndReturn ( None ) <EOL> self . mox . ReplayAll ( ) <EOL> self . c . get ( ) <EOL> self . mox . VerifyAll ( ) <EOL> logging . basicConfig ( filename = '<STR_LIT>' ) <EOL> def main ( unused_argv ) : <EOL> test . main ( unused_argv ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> app . run ( ) </s>
