Skip to content

Commit

Permalink
feat: name query
Browse files Browse the repository at this point in the history
  • Loading branch information
ongsici committed Oct 28, 2024
1 parent cb230d7 commit a43c32c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@


def process_query(input):
if "your name" in input:
return "SiCi"
if input == "dinosaurs":
return "Dinosaurs ruled the Earth 200 million years ago"
else:
Expand Down Expand Up @@ -36,5 +38,5 @@ def submit():

@app.route("/query", methods=["GET"])
def query():
q = request.args.get("q")
q = request.args.get("q", "")
return process_query(q)
3 changes: 3 additions & 0 deletions src/test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ def test_knows_about_dinosaurs():
def test_does_not_know_about_asteroids():
assert process_query("asteroids") == "Unknown"

def test_what_is_your_name():
assert process_query("What is your name?") == "SiCi"


@pytest.fixture
def client():
Expand Down

0 comments on commit a43c32c

Please sign in to comment.