コード例 #1
0
    def testURLForWithAnchro(self):
        app = shimehari.Shimehari(__name__)

        def index():
            return '42'
        app.router = shimehari.Router([Rule('/', endpoint='index', methods=['GET'])])
        app.controllers['index'] = index

        with app.testRequestContext():
            self.assertEqual(shimehari.urlFor('index', _anchor='x y'), '/#x%20y')
コード例 #2
0
ファイル: test_context.py プロジェクト: Epictetus/Shimehari
    def testGenerateURL(self):
        ConfigManager.addConfig(testConfig)
        app = shimehari.Shimehari(__name__)

        def index(*args, **kwargs):
            return 'index'
        app.router = shimehari.Router([Rule('/', endpoint='index', methods=['GET'])])

        with app.appContext():
            rv = shimehari.urlFor('index')
            self.assertEqual(rv, 'https://localhost/')
コード例 #3
0
    def testGenerateURL(self):
        ConfigManager.addConfig(testConfig)
        app = shimehari.Shimehari(__name__)

        def index(*args, **kwargs):
            return "index"

        app.router = shimehari.Router([Rule("/", endpoint="index", methods=["GET"])])

        with app.appContext():
            rv = shimehari.urlFor("index")
            self.assertEqual(rv, "https://localhost/")
コード例 #4
0
    def testGenerateURL(self):
        ConfigManager.addConfig(testConfig)
        app = shimehari.Shimehari(__name__)

        def index(*args, **kwargs):
            return 'index'

        app.router = shimehari.Router(
            [Rule('/', endpoint='index', methods=['GET'])])

        with app.appContext():
            rv = shimehari.urlFor('index')
            self.assertEqual(rv, 'https://localhost/')
コード例 #5
0
ファイル: test_helpers.py プロジェクト: Epictetus/Shimehari
    def testURLForWithAnchro(self):
        app = shimehari.Shimehari(__name__)

        def index():
            return '42'

        app.router = shimehari.Router(
            [Rule('/', endpoint='index', methods=['GET'])])
        app.controllers['index'] = index

        with app.testRequestContext():
            self.assertEqual(shimehari.urlFor('index', _anchor='x y'),
                             '/#x%20y')
コード例 #6
0
 def testRaiseErrorWithoutContext(self):
     with self.assertRaises(RuntimeError):
         shimehari.urlFor("index")
コード例 #7
0
 def testRaiseErrorGenerateURLRequireServerName(self):
     app = shimehari.Shimehari(__name__)
     app.config["SERVER_NAME"] = None
     with app.appContext():
         with self.assertRaises(RuntimeError):
             shimehari.urlFor("index")
コード例 #8
0
 def testRaiseErrorWithoutContext(self):
     with self.assertRaises(RuntimeError):
         shimehari.urlFor('index')
コード例 #9
0
 def testRaiseErrorGenerateURLRequireServerName(self):
     app = shimehari.Shimehari(__name__)
     app.config['SERVER_NAME'] = None
     with app.appContext():
         with self.assertRaises(RuntimeError):
             shimehari.urlFor('index')