# Path: articlemeta/articlemeta.py
# DEFAULT_FROM_DATE = '1900-01-01'
# def _get_request_limit_param(request, default_limit=1000,
#                              only_positive_limit=True, force_max_limit_to_default=True):
# def notfound(request):
# def index(request):
# def get_collection(request):
# def identifier_collection(request):
# def get_journal(request):
# def identifiers_journal(request):
# def identifiers_issue(request):
# def exists_journal(request):
# def exists_issue(request):
# def get_issue(request):
# def get_issues(request):
# def identifiers_article(request):
# def identifiers_press_release(request):
# def exists_article(request):
# def get_article(request):
# def get_articles(request):
# def list_historychanges(request):


import unittest
import pyramid.httpexceptions as exc
from pyramid import testing
from articlemeta import articlemeta
# coding: utf-8




class ViewsTest(unittest.TestCase):

    def setUp(self):
        self.config = testing.setUp()

    def tearDown(self):
        testing.tearDown()

    def test_get_request_limit_param_by_default(self):
        """
        test default behavior of the helper function: _get_request_limit_param
        - only positive limits are allowed
        - if request.limit is greater than default_limit, will return the default limit (1000)
        """
        # set a list of tuples (limit requested, limit expected in response)
        limits = [(1,1), (10, 10), (1000, 1000), (2000, 1000), (12000, 1000)]

        for req_limit, resp_limit in limits:
            request = testing.DummyRequest(params={'limit': req_limit})

# Path: articlemeta/articlemeta.py
# DEFAULT_FROM_DATE = '1900-01-01'
# def _get_request_limit_param(request, default_limit=1000,
#                              only_positive_limit=True, force_max_limit_to_default=True):
# def notfound(request):
# def index(request):
# def get_collection(request):
# def identifier_collection(request):
# def get_journal(request):
# def identifiers_journal(request):
# def identifiers_issue(request):
# def exists_journal(request):
# def exists_issue(request):
# def get_issue(request):
# def get_issues(request):
# def identifiers_article(request):
# def identifiers_press_release(request):
# def exists_article(request):
# def get_article(request):
# def get_articles(request):
# def list_historychanges(request):


# Path: tests/test_view.py
import unittest
import pyramid.httpexceptions as exc
from pyramid import testing
from articlemeta import articlemeta

# coding: utf-8




class ViewsTest(unittest.TestCase):

    def setUp(self):
        self.config = testing.setUp()

    def tearDown(self):
        testing.tearDown()

    def test_get_request_limit_param_by_default(self):
        """
        test default behavior of the helper function: _get_request_limit_param
        - only positive limits are allowed
        - if request.limit is greater than default_limit, will return the default limit (1000)
        """
        # set a list of tuples (limit requested, limit expected in response)
        limits = [(1,1), (10, 10), (1000, 1000), (2000, 1000), (12000, 1000)]

        for req_limit, resp_limit in limits:
            request = testing.DummyRequest(params={'limit': req_limit})

            result_limit = articlemeta._get_request_limit_param(request)