#!/bin/python # -*- coding: utf-8 -*- """ Unit tests for gluon.html """ import unittest from fix_path import fix_sys_path fix_sys_path(__file__) from html import * from html import verifyURL from storage import Storage class TestBareHelpers(unittest.TestCase): def testBR(self): self.assertEqual(BR(_a='1', _b='2').xml(), '<br a="1" b="2" />') def testEMBED(self): self.assertEqual(EMBED(_a='1', _b='2').xml(), '<embed a="1" b="2" />') def testHR(self): self.assertEqual(HR(_a='1', _b='2').xml(), '<hr a="1" b="2" />') def testIMG(self): self.assertEqual(IMG(_a='1', _b='2').xml(),
def main(): fix_path.fix_sys_path() run_wsgi_app(application)
#!/usr/bin/env python # -*- coding: utf-8 -*- """Unit tests for http.py """ import unittest from fix_path import fix_sys_path fix_sys_path(__file__) from http import HTTP, defined_status class TestHTTP(unittest.TestCase): """ Tests http.HTTP """ def test_status_message(self): """ Tests http status code message """ h = HTTP def gen_status_str(code, message): return str(code) + ' ' + str(message) message = '1423 This is a custom message' code = 1423 self.assertEqual(str(h(gen_status_str(code, message))), gen_status_str(code, message)) # test predefined codes for code in defined_status.keys():
# TODO: Docstrings. import logging import re from cStringIO import StringIO from django.utils import html from django.utils import text import config import utils # Fix sys.path import fix_path fix_path.fix_sys_path() # Import markup module from lib/ import markdown import markdown_processor import rst_directive import textile from docutils.core import publish_parts CUT_SEPARATOR_REGEX = r"<!--.*cut.*-->" def render_rst(content): warning_stream = StringIO() parts = publish_parts(
# TODO: Add summary rendering. # TODO: Docstrings. import logging import re from cStringIO import StringIO from django.utils import html from django.utils import text import config import utils # Fix sys.path import fix_path fix_path.fix_sys_path() # Import markup module from lib/ import markdown import markdown_processor import rst_directive import textile from docutils.core import publish_parts CUT_SEPARATOR_REGEX = r'<!--.*cut.*-->' def render_rst(content): warning_stream = StringIO() parts = publish_parts(content, writer_name='html4css1',
# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # -*- coding: utf-8 -*- from fix_path import fix_sys_path fix_sys_path() from config import secrets from webapp2 import WSGIApplication, Route from webapp2_extras import routes from handlers import home, user, redirect, error # webapp2 config config = { 'webapp2_extras.sessions': { 'cookie_name': '_piskel_session', 'secret_key': secrets.SESSION_KEY }, 'webapp2_extras.auth': { 'user_attributes': []
# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # # -*- coding: utf-8 -*- from fix_path import fix_sys_path fix_sys_path() from config import secrets from webapp2 import WSGIApplication, Route from webapp2_extras import routes from handlers import home, user, redirect # webapp2 config config = { 'webapp2_extras.sessions': { 'cookie_name': '_piskel_session', 'secret_key': secrets.SESSION_KEY },