def newuser(): with api.test_client("*****@*****.**") as c: resp = c.user.delete() assert resp.code == 200 or resp.code == 403 with api.test_client() as c: resp = c.user.post({ "email": "*****@*****.**", "password": "******" }) assert resp.code == 200 yield resp.rv with api.test_client("*****@*****.**") as c: resp = c.user.delete() assert resp.code == 200
def newuser(): with api.test_client("*****@*****.**") as c: resp = c.user.delete() assert resp.code == 200 or resp.code == 403 with api.test_client() as c: resp = c.user.post({ "email": "*****@*****.**", "password": "******", "nickname": "tester", "photo": "http://pic.todos.com/photo/tester.png" }) assert resp.code == 200 yield resp.rv with api.test_client("*****@*****.**") as c: resp = c.user.delete() assert resp.code == 200
def test_get(res): with api.test_client() as c: assert c.user.get().code == 403 resp = res.user.get() assert resp.code == 200 assert resp.rv["nickname"] == "tester" assert resp.rv["photo"] == "http://pic.todos.com/photo/tester.png" assert "pwdhash" not in resp.rv
def res(newuser): with api.test_client("*****@*****.**") as c: yield c