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
def test_get_badge(): eq_(get_badge("___not.a.badge"),None)
def test_register_badge(): b = BadgePrototype("test.testbadge4") register_badge(b) eq_(get_badge("test.testbadge4"),b)