def test_form_name_provided(string_under_test, is_valid): with application.test_request_context( '/v1/publish/event/form?form={}'.format(string_under_test)): response, args = middleware.form_name_provided(request=flask.request) assert response is is_valid if is_valid: assert args['form_name'] == string_under_test
def test_convert_xml_to_dict(string_under_test, is_valid): with application.test_request_context('/v1/publish/event/form', data=string_under_test): response, args = middleware.convert_xml_to_dictionary_object( request=flask.request) assert response is is_valid if is_valid: assert isinstance(args['xml_as_dict'], dict)
def test_get_xml_from_request(string_under_test, is_valid): form_name = 'sample_form_name' with application.test_request_context('/v1/publish/event/form', data=string_under_test): response, args = middleware.get_xml_from_request(request=flask.request, payload=dict( {form_name: {}}), form_name=form_name) assert response is True assert 'xml_bytes' in args assert len(args['xml_bytes']) > 0
def test_content_type_is_xml(string_under_test, is_valid): with application.test_request_context('/v1/publish/event/form', content_type=string_under_test): response, args = middleware.content_type_is_xml(request=flask.request) assert response is is_valid