Beispiel #1
0
def test_user_signup(context):
    # Given that I send a post request to user signup
    response = context.http.post('/signup',
                                 body=json.dumps({
                                     'email': '*****@*****.**',
                                     'password1': '123insecure',
                                     'password2': '123insecure',
                                 }),
                                 headers={'content-type': 'application/json'})

    # When I check the response
    response.status_code.should.equal(200)

    # Then the database shoulc contain one user
    users = User.all()
    total_users = len(users)
    assert total_users == 1
Beispiel #2
0
def list_users():
    users = User.all()
    data = [{'email': u.email, 'id': u.id} for u in users]
    return json_response(data)