<s> import os <EOL> os . environ [ '<STR_LIT>' ] = os . environ . get ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> from tests import base <EOL> def setUpModule ( ) : <EOL> """<STR_LIT>""" <EOL> base . enabledPlugins . append ( '<STR_LIT>' ) <EOL> base . enabledPlugins . append ( '<STR_LIT>' ) <EOL> base . enabledPlugins . append ( '<STR_LIT>' ) <EOL> base . enabledPlugins . append ( '<STR_LIT>' ) <EOL> base . startServer ( False ) <EOL> def tearDownModule ( ) : <EOL> """<STR_LIT>""" <EOL> base . stopServer ( ) <EOL> class SourceTestCase ( base . TestCase ) : <EOL> """<STR_LIT>""" <EOL> def setUp ( self ) : <EOL> """<STR_LIT>""" <EOL> super ( SourceTestCase , self ) . setUp ( ) <EOL> self . _user = self . model ( '<STR_LIT:user>' ) . createUser ( <EOL> '<STR_LIT>' , '<STR_LIT:password>' , '<STR_LIT>' , '<STR_LIT:user>' , <EOL> '<STR_LIT>' ) <EOL> def testSource ( self ) : <EOL> """<STR_LIT>""" <EOL> path = '<STR_LIT>' <EOL> params = { <EOL> '<STR_LIT>' : self . _user [ '<STR_LIT>' ] , <EOL> } <EOL> response = self . request ( path = path , method = '<STR_LIT:GET>' , params = params ) <EOL> self . assertStatusOk ( response ) <EOL> folder = response . json [ '<STR_LIT>' ] <EOL> self . assertEquals ( folder , None ) <EOL> response = self . request ( path = path , method = '<STR_LIT:POST>' , params = params ) <EOL> self . assertStatus ( response , <NUM_LIT> ) <EOL> response = self . request ( path = path , method = '<STR_LIT:POST>' , params = params , user = self . _user ) <EOL> self . assertStatusOk ( response ) <EOL> folder = response . json [ '<STR_LIT>' ] <EOL> self . assertNotEquals ( folder , None ) <EOL> self . assertEquals ( folder [ '<STR_LIT>' ] , '<STR_LIT:user>' ) <EOL> self . assertEquals ( folder [ '<STR_LIT>' ] , str ( self . _user [ '<STR_LIT>' ] ) ) <EOL> response = self . request ( path = path , method = '<STR_LIT:GET>' , params = params ) <EOL> self . assertStatusOk ( response ) <EOL> folder = response . json [ '<STR_LIT>' ] <EOL> self . assertEquals ( folder , None ) <EOL> response = self . request ( path = path , method = '<STR_LIT:GET>' , params = params , user = self . _user ) <EOL> self . assertStatusOk ( response ) <EOL> folder = response . json [ '<STR_LIT>' ] <EOL> self . assertNotEquals ( folder , None ) <EOL> self . assertEquals ( folder [ '<STR_LIT>' ] , '<STR_LIT:user>' ) <EOL> self . assertEquals ( folder [ '<STR_LIT>' ] , str ( self . _user [ '<STR_LIT>' ] ) ) <EOL> params = { <EOL> '<STR_LIT:name>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : folder [ '<STR_LIT>' ] <EOL> } <EOL> response = self . request ( path = '<STR_LIT>' , method = '<STR_LIT:POST>' , params = params , <EOL> user = self . _user ) <EOL> item1Id = response . json [ '<STR_LIT>' ] <EOL> params = { <EOL> '<STR_LIT:name>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : folder [ '<STR_LIT>' ] <EOL> } <EOL> response = self . request ( path = '<STR_LIT>' , method = '<STR_LIT:POST>' , params = params , <EOL> user = self . _user ) <EOL> item2Id = response . json [ '<STR_LIT>' ] <EOL> path = '<STR_LIT>' <EOL> params = { <EOL> '<STR_LIT>' : self . _user [ '<STR_LIT>' ] , <EOL> } <EOL> response = self . request ( path = path , method = '<STR_LIT:GET>' , params = params ) <EOL> self . assertStatusOk ( response ) <EOL> self . assertEquals ( len ( response . json ) , <NUM_LIT:0> ) <EOL> response = self . request ( path = path , method = '<STR_LIT:GET>' , params = params , user = self . _user ) <EOL> self . assertStatusOk ( response ) <EOL> self . assertEquals ( len ( response . json ) , <NUM_LIT:2> ) <EOL> sourceIds = [ d [ '<STR_LIT>' ] for d in response . json ] <EOL> self . assertTrue ( item1Id in sourceIds , "<STR_LIT>" ) <EOL> self . assertTrue ( item2Id in sourceIds , "<STR_LIT>" ) </s>
