Esempio n. 1
0
    def test_decorator(self):
        r = Router()

        @r.register(r'^test/$')
        def func(request):
            pass

        self.assertEqual(r.resolve('test/'), (func, (), {}))
Esempio n. 2
0
    def test_register(self):
        r = Router()

        def func(request):
            pass
        r.register(r'^test/$', func)

        self.assertEqual(r.resolve('test/'), (func, (), {}))
Esempio n. 3
0
    def test_resolver(self):
        def func(request):
            pass

        r = Router(
            (r'^test/$', func),
        )

        self.assertTrue(r.is_valid_path('test/'))
        self.assertFalse(r.is_valid_path('not-found/'))
Esempio n. 4
0
import hashlib
import os

import redis
from rq import Queue
import peewee

from rivr.router import Router
from rivr.http import Response, RESTResponse
from rivr.views import RESTView

from palaverapi.models import database, Device, Token
from palaverapi.utils import send_notification


router = Router()
app = router

redis_url = os.getenv('REDISTOGO_URL', 'redis://*****:*****@router.register(r'^$')
def status(request):
    return Response(status=204)


class RegisterView(RESTView):
    def post(self, request):
        apns_token = request.POST['device_token']
Esempio n. 5
0
import uuid
import os

import redis
from rq import Queue
import peewee

from rivr.router import Router
from rivr.http import Http404, Response, RESTResponse
from rivr.views import RESTView

from palaverapi.models import database, Device, Token
from palaverapi.utils import send_notification


router = Router()
app = router

redis_url = os.getenv('REDIS_URL', 'redis://*****:*****@router.register(r'^$')
def status(request):
    return Response(status=204)

@router.register(r'^500$')
def crash(request):
    raise RuntimeError("You are eaten by a grue")