<s> """<STR_LIT>""" <EOL> from twisted . scripts import tap2deb <EOL> from twisted . python import usage , procutils <EOL> from twisted . python . filepath import FilePath <EOL> from twisted . trial . unittest import TestCase , SkipTest <EOL> class TestTap2DEB ( TestCase ) : <EOL> """<STR_LIT>""" <EOL> maintainer = "<STR_LIT>" <EOL> def test_maintainerOption ( self ) : <EOL> """<STR_LIT>""" <EOL> config = tap2deb . MyOptions ( ) <EOL> self . assertRaises ( usage . UsageError , config . parseOptions , [ ] ) <EOL> self . assertRaises ( SystemExit , tap2deb . run , [ ] ) <EOL> def test_optionDefaults ( self ) : <EOL> """<STR_LIT>""" <EOL> config = tap2deb . MyOptions ( ) <EOL> config . parseOptions ( [ '<STR_LIT>' , self . maintainer ] ) <EOL> self . assertEqual ( config [ '<STR_LIT>' ] , '<STR_LIT>' ) <EOL> self . assertEqual ( config [ '<STR_LIT>' ] , self . maintainer ) <EOL> self . assertEqual ( config [ '<STR_LIT>' ] , '<STR_LIT>' ) <EOL> self . assertEqual ( config [ '<STR_LIT:description>' ] , '<STR_LIT>' ) <EOL> self . assertEqual ( config [ '<STR_LIT>' ] , '<STR_LIT>' ) <EOL> self . assertEqual ( config [ '<STR_LIT>' ] , '<STR_LIT:1.0>' ) <EOL> self . assertEqual ( config [ '<STR_LIT>' ] , None ) <EOL> self . assertEqual ( config [ '<STR_LIT:type>' ] , '<STR_LIT>' ) <EOL> def test_missingMaintainer ( self ) : <EOL> """<STR_LIT>""" <EOL> error = self . assertRaises ( SystemExit , tap2deb . run , <EOL> [ "<STR_LIT>" , "<STR_LIT:foo>" ] ) <EOL> self . assertTrue ( str ( error ) . endswith ( '<STR_LIT>' ) ) <EOL> def test_basicOperation ( self ) : <EOL> """<STR_LIT>""" <EOL> if not procutils . which ( "<STR_LIT>" ) : <EOL> raise SkipTest ( "<STR_LIT>" ) <EOL> baseDir = FilePath ( self . mktemp ( ) ) <EOL> baseDir . makedirs ( ) <EOL> version = '<STR_LIT:1.0>' <EOL> tapName = '<STR_LIT>' <EOL> tapFile = baseDir . child ( "<STR_LIT>" % ( tapName , ) ) <EOL> tapFile . setContent ( "<STR_LIT>" ) <EOL> buildDir = FilePath ( '<STR_LIT>' ) <EOL> outputDir = buildDir . child ( '<STR_LIT>' % ( tapName , version ) ) <EOL> args = [ "<STR_LIT>" , tapFile . path , "<STR_LIT>" , self . maintainer ] <EOL> tap2deb . run ( args ) <EOL> self . assertEqual ( sorted ( outputDir . listdir ( ) ) , <EOL> [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> debianDir = outputDir . child ( '<STR_LIT>' ) <EOL> for name in [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT:default>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] : <EOL> self . assertTrue ( debianDir . child ( name ) . exists ( ) ) <EOL> self . assertTrue ( buildDir . child ( '<STR_LIT>' ) . exists ( ) ) <EOL> self . assertTrue ( buildDir . child ( '<STR_LIT>' ) . exists ( ) ) <EOL> self . assertTrue ( buildDir . child ( '<STR_LIT>' ) . exists ( ) ) <EOL> self . assertEqual ( <EOL> len ( buildDir . globChildren ( '<STR_LIT>' ) ) , <NUM_LIT:1> ) </s>
