# 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
            (2000, new_default_limit), (12000, new_default_limit)
        ]

        for req_limit, resp_limit in limits:
            request = testing.DummyRequest(params={'limit': req_limit})
            result_limit = articlemeta._get_request_limit_param(request, default_limit=new_default_limit)
            self.assertEqual(result_limit, resp_limit)

    def test_get_request_limit_param_with_limit_zero_NOT_allowed(self):
        """
        By default the _get_request_limit_param will NOT accept request it limit <= 0
        So here test that a BadRequestException is raised
        """
        limits = [(0,0), (-1, -1), (-1000, -1000)]

        for req_limit, resp_limit in limits:
            request = testing.DummyRequest(params={'limit': req_limit})
            self.assertRaises(exc.HTTPBadRequest,
                              articlemeta._get_request_limit_param,
                              request)

    def test_get_request_limit_param_with_limit_zero_allowed(self):
        """
        _get_request_limit_param can accept request it limit <= 0
        So here test that and returns a valid number
        """
        limits = [(0,0), (-1, -1), (-1000, -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

            (2000, new_default_limit), (12000, new_default_limit)
        ]

        for req_limit, resp_limit in limits:
            request = testing.DummyRequest(params={'limit': req_limit})
            result_limit = articlemeta._get_request_limit_param(request, default_limit=new_default_limit)
            self.assertEqual(result_limit, resp_limit)

    def test_get_request_limit_param_with_limit_zero_NOT_allowed(self):
        """
        By default the _get_request_limit_param will NOT accept request it limit <= 0
        So here test that a BadRequestException is raised
        """
        limits = [(0,0), (-1, -1), (-1000, -1000)]

        for req_limit, resp_limit in limits:
            request = testing.DummyRequest(params={'limit': req_limit})
            self.assertRaises(exc.HTTPBadRequest,
                              articlemeta._get_request_limit_param,
                              request)

    def test_get_request_limit_param_with_limit_zero_allowed(self):
        """
        _get_request_limit_param can accept request it limit <= 0
        So here test that and returns a valid number
        """
        limits = [(0,0), (-1, -1), (-1000, -1000)]

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

            result_limit = articlemeta._get_request_limit_param(request, only_positive_limit=False)