File tree Expand file tree Collapse file tree 3 files changed +41
-2
lines changed
Expand file tree Collapse file tree 3 files changed +41
-2
lines changed Original file line number Diff line number Diff line change 22pytest-cov
33flask-wtf
44flask-sqlalchemy
5+ beautifulsoup4
Original file line number Diff line number Diff line change 1- # SHA1:2bce3613bf781b5318773bbd23ef6330092309f9
1+ # SHA1:34838a637a8bb69340f90a1de71e46b007e4a5d6
22#
33# This file is autogenerated by pip-compile-multi
44# To update, run:
55#
66# pip-compile-multi
77#
8+ beautifulsoup4==4.13.4
9+ # via -r requirements/tests.in
810blinker==1.8.2
911 # via flask
1012click==8.1.8
@@ -50,12 +52,16 @@ pytest-cov==5.0.0
5052 # via -r requirements/tests.in
5153sqlalchemy==2.0.38
5254 # via flask-sqlalchemy
55+ soupsieve==2.7
56+ # via beautifulsoup4
5357tomli==2.2.1
5458 # via
5559 # coverage
5660 # pytest
5761typing-extensions==4.12.2
58- # via sqlalchemy
62+ # via
63+ # beautifulsoup4
64+ # sqlalchemy
5965werkzeug==3.0.6
6066 # via flask
6167wtforms==3.1.2
Original file line number Diff line number Diff line change 1+ import pytest
2+ from bs4 import BeautifulSoup
3+ from flask import Flask , render_template_string
4+
5+
6+ @pytest .fixture
7+ def app ():
8+ app = Flask (__name__ )
9+ app .secret_key = "test"
10+ return app
11+
12+
13+ def test_cdn_integrity (app ):
14+ @app .route ("/" )
15+ def index ():
16+ return render_template_string (
17+ "{{ bootstrap.load_css() }}{{ bootstrap.load_js() }}"
18+ )
19+
20+ client = app .test_client ()
21+ response = client .get ("/" )
22+ html = response .get_data (as_text = True )
23+ soup = BeautifulSoup (html , "html.parser" )
24+
25+ css = soup .find ("link" , rel = "stylesheet" )
26+ js = soup .find ("script" , src = lambda s : s and "bootstrap" in s )
27+
28+ bootstrap = app .extensions ["bootstrap" ]
29+ assert css ["integrity" ] == bootstrap .bootstrap_css_integrity
30+ assert js ["integrity" ] == bootstrap .bootstrap_js_integrity
31+ assert css ["crossorigin" ] == "anonymous"
32+ assert js ["crossorigin" ] == "anonymous"
You can’t perform that action at this time.
0 commit comments