def METHOD_NAME(user, expected_code):
    with app.test_client() as client:
        if user is not None:
            login_user(user, client)
        res = client.get(url, headers=headers)
        assert res.status_code == expected_code