From 634143172c53ad378d38f39faabed0180b06e039 Mon Sep 17 00:00:00 2001 From: abregman Date: Sun, 22 Dec 2019 11:30:09 +0200 Subject: [PATCH] Update flask_container_ci challenge --- challenges/flask_container_ci/README.md | 7 +++++-- challenges/flask_container_ci/app/app.py | 5 ++--- challenges/flask_container_ci/users.json | 12 ++++++++---- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/challenges/flask_container_ci/README.md b/challenges/flask_container_ci/README.md index 149f974..b9d97bc 100644 --- a/challenges/flask_container_ci/README.md +++ b/challenges/flask_container_ci/README.md @@ -11,6 +11,7 @@ Please read carefully all the instructions. If any of the following steps is not working, it is expected from you to fix them +1. Move to `challenges/flask_container_ci` directory, if you are not already there 1. Run `export FLASK_APP=app/app.py` 1. To run the app execute `flask run`. If it doesn't works, fix it 3. Access `http://127.0.0.1:5000`. You should see the following @@ -27,8 +28,10 @@ If any of the following steps is not working, it is expected from you to fix the 4. You should be able to access any of the resources and get the following data: -* /users/ - data on the specific chosen user * /users - all users data +* /users/ - data on the specific chosen user + +5. When accessing /users, the data returned should not include the id of the user, only its name and description. Also, the data should be ordered by users names. ## Containers @@ -40,7 +43,7 @@ docker run -d -p 5000:5000 app ``` 1. You can use any image base you would like -2. Containrize only what you need for running the application, nothing else. +2. Containerize only what you need for running the application, nothing else. ## CI diff --git a/challenges/flask_container_ci/app/app.py b/challenges/flask_container_ci/app/app.py index 9bd5d71..e143571 100644 --- a/challenges/flask_container_ci/app/app.py +++ b/challenges/flask_container_ci/app/app.py @@ -4,9 +4,8 @@ from flask import Flask from flask import make_response -from werkzeug.exceptions import NotFound - import json +from werkzeug.exceptions import NotFound app = Flask(__name__) @@ -15,7 +14,7 @@ with open("./users.json", "r") as f: users = json.load(f) -@app.route("/", methods=['GET']) +@app.routee("/", methods=['GET']) def index(): return pretty_json({ "resources": { diff --git a/challenges/flask_container_ci/users.json b/challenges/flask_container_ci/users.json index fe0b54a..04068d5 100644 --- a/challenges/flask_container_ci/users.json +++ b/challenges/flask_container_ci/users.json @@ -1,18 +1,22 @@ { "geralt" : { "id": "whitewolf", - "name": "Geralt of Rivia" + "name": "Geralt of Rivia", + "description": "Traveling monster slayer for hire" }, "lara_croft" : { "id": "m31a3n6sion", - "name": "Lara Croft" + "name": "Lara Croft", + "description": "Highly intelligent and athletic English archaeologist" }, "mario" : { "id": "smb3igiul", - "name": "Mario" + "name": "Mario", + "description": "Italian plumber who really likes mushrooms" }, "gordon_freeman" : { "id": "nohalflife3", - "name": "Gordon Freeman" + "name": "Gordon Freeman", + "description": "Physicist with great shooting skills" } }