#NEWLINE# @ classmethod #NEWLINE# def setup_class( cls ) : #NEWLINE# #INDENT# cls . zapp_yaml_contents = 'execution:\n  groups:\n    - name: "hello"\n      path: file://python2.7:python\n      args: "hello.py"\n      devices:\n      - name: python\n      - name: stdout\nmeta:\n  Version: ""\n  name: "hello"\n  Author-email: ""\n  Summary: ""\nhelp:\n  description: ""\n  args:\n  - ["", ""]\nbundling:\n  - "hello.py"\nui:\n  - "index.html"\n  - "foo.js.tmpl"\n' . encode ( 'utf-8' ) #NEWLINE# cls . job_json_contents = json . dumps ( [ { #NEWLINE# #INDENT# 'exec' : { #NEWLINE# #INDENT# 'args' : 'hello.py' , #NEWLINE# 'path' : 'file://python2.7:python' , #NEWLINE# #UNINDENT# } , #NEWLINE# 'devices' : [ { #NEWLINE# #INDENT# 'name' : 'python' , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'name' : 'stdout' , #NEWLINE# #UNINDENT# } ] , #NEWLINE# 'name' : 'hello' , #NEWLINE# #UNINDENT# } ] ) . encode ( 'utf-8' ) #NEWLINE# cls . job_json_prepped = json . dumps ( [ { #NEWLINE# #INDENT# 'exec' : { #NEWLINE# #INDENT# 'path' : 'file://python2.7:python' , #NEWLINE# 'args' : 'hello.py' , #NEWLINE# #UNINDENT# } , #NEWLINE# 'devices' : [ { #NEWLINE# #INDENT# 'name' : 'python' , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'name' : 'stdout' , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'name' : 'image' , #NEWLINE# 'path' : 'swift:///container1/foo/bar/zapp.yaml' , #NEWLINE# #UNINDENT# } ] , #NEWLINE# 'name' : 'hello' , #NEWLINE# #UNINDENT# } ] ) . encode ( 'utf-8' ) #NEWLINE# cls . hellopy_contents = b'print("Hello from ZeroVM!")\n' #NEWLINE# cls . indexhtml_contents = bytearray ( '<html>\n<head><title>Hello!</title></head>\n<body>Hello from ZeroVM!</body>\n</html>' , 'utf-8' ) #NEWLINE# cls . foojstmpl_contents = b'var opts = {{ auth_opts }};' #NEWLINE# cls . temp_dir = tempfile . mkdtemp ( ) #NEWLINE# cls . temp_zapp_file = ( '%s/zapp.yaml' % cls . temp_dir ) #NEWLINE# tar = tarfile . open ( cls . temp_zapp_file , 'w:gz' ) #NEWLINE# info = tarfile . TarInfo ( name = 'foo.js.tmpl' ) #NEWLINE# info . size = len ( tar . foojstmpl_contents ) #NEWLINE# tar . addfile ( info , BytesIO ( cls . foojstmpl_contents ) ) #NEWLINE# info = tarfile . TarInfo ( name = 'boot/system.map' ) #NEWLINE# info . size = len ( cls . job_json_contents ) #NEWLINE# tar . addfile ( info , BytesIO ( cls . job_json_contents ) ) #NEWLINE# info = tarfile . TarInfo ( name = 'zapp.yaml' ) #NEWLINE# info . size = len ( cls . zapp_yaml_contents ) #NEWLINE# tar . addfile ( info , BytesIO ( cls . zapp_yaml_contents ) ) #NEWLINE# info = tarfile . TarInfo ( name = 'hello.py' ) #NEWLINE# info . size = len ( cls . hellopy_contents ) #NEWLINE# tar . addfile ( info , BytesIO ( cls . hellopy_contents ) ) #NEWLINE# info = tarfile . TarInfo ( name = 'index.html' ) #NEWLINE# info . size = len ( cls . indexhtml_contents ) #NEWLINE# tar . addfile ( info , BytesIO ( cls . indexhtml_contents ) ) #NEWLINE# tar . close ( )