Getting a 500 error in Python Flask while making a POST -
i getting internal server error when i'm trying perform post. uncertain supposed missing parameters methods when supposed entirely new.
this create_section method section_repository.py:
def create_section(section, created_by): params = [section.section_header, created_by.id] create_section = 'community.create_section' result = { 'section_id': none, 'status': none, 'message': none } rows = database.func(create_section, params) print(rows) if len(rows): result['section_id'] = rows[0].get('id') result['status'] = rows[0].get('status') result['message'] = rows[0].get('message') return result it used in section_controller.py follows:
def create_section(section, created_by): """ create section """ cs = curated_section_repository.create_section(section, created_by) return jsonify(cs.get_serialized()) and route defined in section_route.py this:
@section.route('/sections/<section_id>', methods=['post']) def create_section(section_id): """ create new section """ return section_controller.create_curated_section(curated_section_id) i can @ least conclude return statement of route has incorrect argument, unable surmise how correct parameters should retrieved since creating entirely new section.
the actual post method performed subroutine in pytest defined as:
@pytest.fixture def authorized_client(client): global token form = { "email": "webmaster@example.com", "password": "password1" } response = login(client, form) token = json_of_response(response).get(('session_token')) yield client logout(client, token) token = none def test_create_section_success(authorized_client): """ post /sections/<section_id> """ response = post_authorized(authorized_client, '/sections/3', none, token) assert response.status_code == 200 do take note 3 id i've decided new section i'm trying make.
Comments
Post a Comment