'Make sure the pagination behaves properly when the requested page is out
of range.'

def test_gitlog_pagination_out_of_range_invalid(self):

    self._setstaff_login()
    mongoengine.connect(TEST_MONGODB_LOG['db'])
    for _ in xrange(15):
        CourseImportLog(course_id=CourseKey.from_string('test/test/test'), location='location', import_log='import_log', git_log='git_log', repo_dir='repo_dir', created=datetime.now()).save()
    for (page, expected) in [((-1), 1), (1, 1), (2, 2), (30, 2), ('abc', 1)]:
        response = self.client.get('{}?page={}'.format(reverse('gitlogs'), page))
        self.assertIn('Page    {}    of    2'.format(expected), response.content)
    CourseImportLog.objects.delete()
