Ejemplo n.º 1
0
def gimme():
    response.content_type = "text/plain"
    body = Queue()
    body.put("Went to gimme-a-badge...")

    def _result(received):
        if received:
            body.put("Got badge ")
            body.put(received.badge_id)
        body.put(StopIteration)

    # user-id as the md5 of the name just for testing
    user = User(request.query.name or 'anon')
    badge.get_badge("testbadge1").award(ds, user, _result)
    return body
Ejemplo n.º 2
0
def gimme():
    response.content_type = "text/plain"
    body = Queue()
    body.put("Went to gimme-a-badge...")

    def _result(received):
        if received:
            body.put("Got badge ")
            body.put(received.badge_id)
        body.put(StopIteration)

    # user-id as the md5 of the name just for testing
    user = User(request.query.name or 'anon')
    badge.get_badge("testbadge1").award(ds, user, _result)
    return body
Ejemplo n.º 3
0
def test_get_badge():
    eq_(get_badge("___not.a.badge"),None)
Ejemplo n.º 4
0
def test_register_badge():
    b = BadgePrototype("test.testbadge4")
    register_badge(b)

    eq_(get_badge("test.testbadge4"),b)