def test_metas(app, create_cves): create_cves(["CVE-2018-18074", "CVE-2020-9392", "CVE-2020-26116", "CVE-2020-27781"]) with app.test_request_context(): cves, metas, _ = CveController.list() assert len(cves.items) == 4 assert metas == {"vendor": None, "product": None, "tag": None} cves, metas, _ = CveController.list({"vendor": "python"}) assert len(cves.items) == 1 assert metas["vendor"].name == "python" cves, metas, _ = CveController.list( {"vendor": "redhat", "product": "ceph_storage"} ) assert len(cves.items) == 1 assert metas["vendor"].name == "redhat" assert metas["product"].name == "ceph_storage"
def cves(): objects, metas, pagination = CveController.list(request.args) return render_template( "cves.html", cves=objects, vendor=metas.get("vendor"), product=metas.get("product"), pagination=pagination, )
def cves(): args = request.args user_tags = [] if current_user.is_authenticated: args = {**request.args, "user_id": current_user.id} user_tags = UserTagController.list_items({"user_id": current_user.id}) objects, metas, pagination = CveController.list(args) return render_template( "cves.html", cves=objects, vendor=metas.get("vendor"), product=metas.get("product"), tag=metas.get("tag"), user_tags=user_tags, pagination=pagination, )