From 67e1da582ca63f4a4c69705a5d376cd6a06e5366 Mon Sep 17 00:00:00 2001 From: Albin Antony Date: Thu, 2 Nov 2023 21:55:30 +0530 Subject: [PATCH] Add #32 Add BDD test for login --- test/gherkin/behave.ini | 4 ++++ test/gherkin/requirements.txt | 2 ++ test/gherkin/steps/login.py | 23 +++++++++++++++++++++++ 3 files changed, 29 insertions(+) create mode 100644 test/gherkin/behave.ini create mode 100644 test/gherkin/requirements.txt create mode 100644 test/gherkin/steps/login.py diff --git a/test/gherkin/behave.ini b/test/gherkin/behave.ini new file mode 100644 index 0000000..a2cb467 --- /dev/null +++ b/test/gherkin/behave.ini @@ -0,0 +1,4 @@ +[behave] +paths = features/ + + diff --git a/test/gherkin/requirements.txt b/test/gherkin/requirements.txt new file mode 100644 index 0000000..556e4e6 --- /dev/null +++ b/test/gherkin/requirements.txt @@ -0,0 +1,2 @@ +behave +requests \ No newline at end of file diff --git a/test/gherkin/steps/login.py b/test/gherkin/steps/login.py new file mode 100644 index 0000000..68fd190 --- /dev/null +++ b/test/gherkin/steps/login.py @@ -0,0 +1,23 @@ +from behave import * +import requests + + +@given("an organization admin for Data4Diabetes organization") +def step_impl(context): + pass + + +@when("the admin logs into the Admin dashboard") +def step_impl(context): + data = { + "username": "admin@retail.com", + "password": "qwerty123", + } + url = "https://staging-consent-bb-api.igrant.io/v2" + "/onboard/admin/login" + response = requests.post(url, json=data) + context.response = response + + +@then("the admin should be able to access pages in the admin dashboard") +def step_impl(context): + assert context.response.status_code == 200