# Path: voeventdb/server/restapi/v1/viewbase.py
# def make_response_dict(result):
#     def get_query(self):
#     def process_query(self, q):
#     def dispatch_request(self):
#     def get_query(self):
#     def process_query(self, query):
#     def set_ordering(self, query):
#     def dispatch_request(self):
# def _add_to_blueprint(queryview_class, blueprint):
# class QueryView(View):
# class ListQueryView(View):
# 
# Path: voeventdb/server/restapi/v1/views.py
# def add_to_apiv1(queryview_class):
# def get_apiv1_rules():
# def error_to_dict(error):
# def validate_ivorn(url_encoded_ivorn):
# def apiv1_root_view():
# def ivorn_error(error):
# def page_not_found(abort_error):
#     def get_query(self):
#     def process_query(self, q):
#     def get_query(self):
#     def process_query(self, query):
#     def get_query(self):
#     def process_query(self, query):
#     def get_query(self):
#     def process_query(self, query):
#     def get_query(self):
#     def process_query(self, q):
#     def get_query(self):
#     def process_query(self, q):
#     def get_query(self):
#     def process_query(self, q):
#     def get_query(self):
#     def process_query(self, q):
# def packet_synopsis(url_encoded_ivorn=None):
# def packet_xml(url_encoded_ivorn=None):
# class Count(QueryView):
# class ListIvorn(ListQueryView):
# class ListIvornReferenceCount(ListQueryView):
# class ListIvornCitedCount(ListQueryView):
# class MapAuthoredMonthCount(QueryView):
# class MapRoleCount(QueryView):
# class MapStreamCount(QueryView):
# class MapStreamRoleCount(QueryView):


import logging
import os
import pytest
import voeventdb.server.restapi.inspection_utils as iu
import pprint
from flask import request, url_for
from voeventdb.server.restapi.v1.viewbase import OrderValues, PaginationKeys
from voeventdb.server.restapi.v1.views import apiv1
    for key in filter_kvs:
        for example in filter_kvs[key]:
            view_filter_value_tuples.append((vn, key, example))

pp = pprint.PrettyPrinter()
# print("TUPLES")
# pp.pprint(view_filter_value_tuples)

def runtests(flask_test_client,
                 view_name,
                 filter_key,
                 filter_value):
    """
    Define the test code once, use it twice - with empty / populated databases
    """
    url = url_for(apiv1.name+'.'+view_name,
                    **{filter_key:filter_value})
    with flask_test_client as c:
        rv = c.get(url)
        logger.debug("URL: {}".format(request.url))

    assert rv.status_code == 200

    ## Test pagination /ordering works too, if it's a list view:
    if view_name in lqv_views:
        for orderby_value in OrderValues._value_list:
            url = url_for(apiv1.name+'.'+view_name,
                        **{filter_key:filter_value,
                           PaginationKeys.limit: 10,
                           PaginationKeys.offset:5,

# Path: voeventdb/server/restapi/v1/viewbase.py
# def make_response_dict(result):
#     def get_query(self):
#     def process_query(self, q):
#     def dispatch_request(self):
#     def get_query(self):
#     def process_query(self, query):
#     def set_ordering(self, query):
#     def dispatch_request(self):
# def _add_to_blueprint(queryview_class, blueprint):
# class QueryView(View):
# class ListQueryView(View):
# 
# Path: voeventdb/server/restapi/v1/views.py
# def add_to_apiv1(queryview_class):
# def get_apiv1_rules():
# def error_to_dict(error):
# def validate_ivorn(url_encoded_ivorn):
# def apiv1_root_view():
# def ivorn_error(error):
# def page_not_found(abort_error):
#     def get_query(self):
#     def process_query(self, q):
#     def get_query(self):
#     def process_query(self, query):
#     def get_query(self):
#     def process_query(self, query):
#     def get_query(self):
#     def process_query(self, query):
#     def get_query(self):
#     def process_query(self, q):
#     def get_query(self):
#     def process_query(self, q):
#     def get_query(self):
#     def process_query(self, q):
#     def get_query(self):
#     def process_query(self, q):
# def packet_synopsis(url_encoded_ivorn=None):
# def packet_xml(url_encoded_ivorn=None):
# class Count(QueryView):
# class ListIvorn(ListQueryView):
# class ListIvornReferenceCount(ListQueryView):
# class ListIvornCitedCount(ListQueryView):
# class MapAuthoredMonthCount(QueryView):
# class MapRoleCount(QueryView):
# class MapStreamCount(QueryView):
# class MapStreamRoleCount(QueryView):


# Path: voeventdb/server/tests/test_rest/test_endpoint_filter_combos.py
import logging
import os
import pytest
import voeventdb.server.restapi.inspection_utils as iu
import pprint
from flask import request, url_for
from voeventdb.server.restapi.v1.viewbase import OrderValues, PaginationKeys
from voeventdb.server.restapi.v1.views import apiv1

    for key in filter_kvs:
        for example in filter_kvs[key]:
            view_filter_value_tuples.append((vn, key, example))

pp = pprint.PrettyPrinter()
# print("TUPLES")
# pp.pprint(view_filter_value_tuples)

def runtests(flask_test_client,
                 view_name,
                 filter_key,
                 filter_value):
    """
    Define the test code once, use it twice - with empty / populated databases
    """
    url = url_for(apiv1.name+'.'+view_name,
                    **{filter_key:filter_value})
    with flask_test_client as c:
        rv = c.get(url)
        logger.debug("URL: {}".format(request.url))

    assert rv.status_code == 200

    ## Test pagination /ordering works too, if it's a list view:
    if view_name in lqv_views:
        for orderby_value in OrderValues._value_list:
            url = url_for(apiv1.name+'.'+view_name,
                        **{filter_key:filter_value,
                           PaginationKeys.limit: 10,
                           PaginationKeys.offset:5,

                           PaginationKeys.order: orderby_value})