Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
Guanghong Zheng committed Oct 21, 2024
1 parent bed24c3 commit 28dffad
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/app.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from flask import Flask, render_template, request


app = Flask(__name__)


Expand All @@ -13,3 +14,11 @@ def submit():
@app.route("/")
def hello_world():
return render_template("index.html")


@app.route("/get", methods=["GET"])
def process_query(query):
if query=="dinosaurs":
return "Dinosaurs ruled the Earth 200 million years ago"
else:
return "Unknown"
7 changes: 7 additions & 0 deletions src/app_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from app import process_query

def test_knows_about_dinosaurs():
assert process_query("dinosaurs") == "Dinosaurs ruled the Earth 200 million years ago"

def test_does_not_know_about_asteroids():
assert process_query("asteroids") == "Unknown"

0 comments on commit 28dffad

Please sign in to comment.