def test_basic_table_contents(self): data = model.DummyTableData([ ['id', 'Id'], ['name', 'Given Name'], ], [ ['1', 'John Smith'], ['2', 'Eve Adams'], ]) result = engine.execute('nunja.molds/table', data=data.to_jsonable()) self.assertEqual( result, '<div data-nunja="nunja.molds/table">\n' '<table class="">\n' ' <thead>\n' ' <tr class="">\n' ' <td>Id</td><td>Given Name</td>\n' ' </tr>\n' ' </thead>\n' ' <tbody>\n' ' <tr class="">\n' ' <td>1</td><td>John Smith</td>\n' ' </tr><tr class="">\n' ' <td>2</td><td>Eve Adams</td>\n' ' </tr>\n' ' </tbody>\n' '</table>\n' '</div>')
async def fsnavtree_demo(request, path=''): if 'application/json' in request.headers.get('accept'): return response.json(dirnav.get_struct(path)) body = body_tmpl % { 'breadcrumb': engine.execute('nunja.stock.molds/breadcrumb', data=bc.get_breadcrumb(path)), 'dir': engine.execute('nunja.stock.molds/model', data=dirnav.get_struct_dirs_only(path)), 'file': engine.execute('nunja.stock.molds/model', data=filenav.get_struct_files_only(path)), } html = engine.render('nunja.molds/html5', data={ 'title': 'Example page', 'js': static_js + provider_js, 'css': static_css, 'body': body, }) return response.html(html)
def test_null_rendering(self): result = engine.execute('nunja.molds/table', data={ 'css': {}, }) self.assertEqual( result, '<div data-nunja="nunja.molds/table">\n' '<table class="">\n' ' <thead>\n' ' <tr class="">\n' ' \n' ' </tr>\n' ' </thead>\n' ' <tbody>\n' ' \n' ' </tbody>\n' '</table>\n' '</div>')
def _method(self): raw = engine.execute(mold_id, data=data) self.assertEqual(reconstitute(answer), reconstitute(raw.splitlines()))
</div> """ # XXX this does NOT work in PY3 due to # - http://bugs.python.org/issue5053 # - http://bugs.python.org/issue5054 if environ.get('HTTP_ACCEPT') == 'application/json': print("Content-Type: application/json") print("") print(json.dumps(nav.get_struct(target))) else: print("Content-Type: text/html") print("") body = body_tmpl % engine.execute('nunja.stock.molds/model', data=nav.get_struct(target)) html = engine.render('nunja.molds/html5', data={ 'title': 'Example page', 'js': [ '/node_modules/requirejs/require.js', '/nunja.stock.js', '/nunja/config.js', 'init.js' ], 'css': [ '/pure-min.css', '/local.css', ], 'body': body,