Beispiel #1
0
def bundles(page):
    ds = Datastore()
    limit = PAGE_LIMIT
    skip = limit * (abs(page) - 1)
    cwr_results, count = ds.distinct(key='bundle_name', limit=limit, skip=skip)
    bundle_title = 'List of all bundles'
    pagination = Pagination(
        page=page, total_count=count, limit_per_page=limit,
        request=request)
    return render_template(
        'bundles.html', cwr_results=cwr_results, bundle_title=bundle_title,
        pagination=pagination)
Beispiel #2
0
def recent_by_bundle(bundle, page):
    ds = Datastore()
    filter = {'bundle_name': bundle}
    limit = PAGE_LIMIT
    skip = limit * (abs(page) - 1)
    cwr_results = ds.get(filter=filter, limit=limit, skip=skip)
    pagination = Pagination(
            page=page, total_count=cwr_results.count(), limit_per_page=limit,
            request=request)
    bundle_title = 'Recent tests: {}'.format(bundle)
    return render_template(
        'recent.html', cwr_results=cwr_results, bundle_title=bundle_title,
        pagination=pagination)
Beispiel #3
0
def recent(page):
    ds = Datastore()
    limit = PAGE_LIMIT
    skip = limit * (abs(page) - 1)
    cwr_results = ds.get(limit=limit, skip=skip)
    bundle_title = 'Recent tests'
    pagination = Pagination(
        page=page, total_count=cwr_results.count(), limit_per_page=limit,
        request=request)
    print cwr_results.count(), limit
    return render_template(
        'recent.html', cwr_results=cwr_results, bundle_title=bundle_title,
        pagination=pagination)
 def test_has_next_false(self):
     pg = Pagination(
         page=1, total_count=5, limit_per_page=10,
         request=None)
     self.assertEqual(pg.has_next, False)
 def test_has_prv_true(self):
     pg = Pagination(
         page=2, total_count=10, limit_per_page=10,
         request=None)
     self.assertEqual(pg.has_prv, True)
 def test_has_next_true_edge(self):
     pg = Pagination(
             page=1, total_count=11, limit_per_page=10,
             request=None)
     self.assertEqual(pg.has_next, True)