1
Fork 0
mirror of https://github.com/Steffo99/referer.steffo.eu.git synced 2024-11-21 10:34:22 +00:00

Add new tests

This commit is contained in:
Steffo 2019-08-05 11:56:14 +02:00
parent 97569fef6f
commit fe75fe2174
5 changed files with 75 additions and 1 deletions

17
app.py
View file

@ -5,7 +5,22 @@ app = f.Flask(__name__)
@app.route("/")
def root_page():
return '<a href="/referer">Click on me!</a>'
return f.render_template("root.html")
@app.route("/link")
def link_page():
return f.render_template("link.html")
@app.route("/location/href")
def location_href_page():
return f.render_template("locationhref.html")
@app.route("/location/replace")
def location_replace_page():
return f.render_template("locationreplace.html")
@app.route('/referer')

12
templates/link.html Normal file
View file

@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>a href</title>
<script>
</script>
</head>
<body>
<a href="/referer">Click on me!</a>
</body>
</html>

View file

@ -0,0 +1,15 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>location.href</title>
<script>
function move() {
location.href = "/referer"
}
</script>
</head>
<body>
<button onclick="move()">Click on me!</button>
</body>
</html>

View file

@ -0,0 +1,15 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>location.replace</title>
<script>
function move() {
location.replace("/referer")
}
</script>
</head>
<body>
<button onclick="move()">Click on me!</button>
</body>
</html>

17
templates/root.html Normal file
View file

@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Referer tests</title>
</head>
<body>
<h1>
Referer tests
</h1>
<ul>
<li><a href="{{ url_for("link_page") }}">Simple link</a></li>
<li><a href="{{ url_for("location_href_page") }}">location.href</a></li>
<li><a href="{{ url_for("location_replace_page") }}">location.replace()</a></li>
</ul>
</body>
</html>