diff --git a/README.md b/README.md index 48be970..c48b9b0 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ # Dev-Sec-Ops Demo/Assignment -[![codecov](https://codecov.io/gh/PGCSEDS-IIITH/devsecops-iris/branch/master/graph/badge.svg?token=EILEH8L7R5)](https://codecov.io/gh/PGCSEDS-IIITH/devsecops-iris) +[![codecov](https://app.codecov.io/gh/kgvrmohan26/devsecops-iris/branch/master/graph/badge.svg?token=EILEH8L7R5)](https://app.codecov.io/gh/kgvrmohan26/devsecops-iris) -This repository contains code which demonstrates Dev-Sec-Ops using a `FastAPI` application which predicts the flower class using the IRIS dataset (https://scikit-learn.org/stable/auto_examples/datasets/plot_iris_dataset.html) +This repository contains code which demonstrates Dev-Sec-Ops using a `FastAPI` application which predicts the flower class using the IRIS dataset (https://scikit-learn.org/stable/auto_examples/datasets/plot_iris_dataset.html). ## Running Instructions - Create a fork of the repo using the `fork` button. -- Clone your fork using `git clone https://www.github.com//mlops-iris.git` +- Clone your fork using `git clone https://github.com/kgvrmohan26/devsecops-iris.git`.. - Install dependencies using `pip3 install -r requirements.txt` - Run application using `python3 main.py` - Run tests using `pytest` @@ -25,4 +25,4 @@ This repository contains code which demonstrates Dev-Sec-Ops using a `FastAPI` a - Make a visualisation for sarif report using any tool. upload screenshot, image, html or pdf. Add it to the reports/ folder. ## Submission -- Link to github repository as a comment on the submission (olympus portal). [uploading .txt is optional] \ No newline at end of file +- Link to github repository as a comment on the submission (olympus portal). [uploading .txt is optional] diff --git a/main.py b/main.py index 231b997..395126f 100644 --- a/main.py +++ b/main.py @@ -30,7 +30,7 @@ class FeedbackIn(BaseModel): sepal_width: float petal_length: float petal_width: float - flower_class: str + flower_class: str='Iris Setosa' # Route definitions diff --git a/test_app.py b/test_app.py index b65fc90..cf215d6 100644 --- a/test_app.py +++ b/test_app.py @@ -24,3 +24,19 @@ def test_pred_virginica(): # asserting the correct response is received assert response.status_code == 200 assert response.json() == {"flower_class": "Iris Virginica"} + +# test to check if Iris Virginica is classified correctly +def test_retrain(): + # defining a sample payload for the testcase + payload = { + "sepal_length": 0, + "sepal_width": 0, + "petal_length": 0, + "petal_width": 0, + "flower_class": 'Iris Setosa' + } + with TestClient(app) as client: + response = client.post("/feedback_loop", json=payload) + # asserting the correct response is received + #assert response.status_code == 200 + #assert response.json() == {"flower_class": "Iris Virginica"}