diff --git a/bloclink/apps/bis/features/addressSearch.feature b/bloclink/apps/bis/features/addressSearch.feature new file mode 100644 index 0000000000000000000000000000000000000000..8c87b363cec93de032d294ff6e7a5b005181c5e8 --- /dev/null +++ b/bloclink/apps/bis/features/addressSearch.feature @@ -0,0 +1,29 @@ +Feature: Building search + + Scenario: Search for a valid building + Given a valid building address + | address | + | 489 Hart Street, Brooklyn, New York 11221, United States | + | 81 Prospect Street, Staten Island, New York 10304, United States | + | Oakland California Temple, 4770 Lincoln Ave, Oakland, California 94602, United States | + Then result page will include code "200" + And result page will include success as "True" + + Scenario: Search for an invalid building + Given an invalid building address + | address | + | Staten Island, New York, New York, United States | + | New York, New York, New York 10453, United States | + | New York, New York, United States | + | New York, New York 10453, United States | + | East New York, Brooklyn, New York, New York 11208, United States | + Then result page will include code "400" + And result page will include success as "False" + + Scenario: Search for a not covered building + Given a not covered building address + | address | + | New Jersey Motor Vehicle Commission, 481 US Route 46 W, Wayne, New Jersey 07470, United States | + | 60 East Jamaica Avenue, Valley Stream, New York 11580, United States | + Then result page will include code "400" + And result page will include success as "False" diff --git a/bloclink/apps/bis/features/steps/addressSearch.py b/bloclink/apps/bis/features/steps/addressSearch.py new file mode 100644 index 0000000000000000000000000000000000000000..da733190b284d50769865ea1a5b263a30c54c86c --- /dev/null +++ b/bloclink/apps/bis/features/steps/addressSearch.py @@ -0,0 +1,42 @@ +from behave import * +import requests +import json + + +endpoint = 'http://0.0.0.0:5410/buildings/bis/submit-building/' +responses = [] + +@given('a valid building address') +def step_impl(context): + global responses + responses = [] + for row in context.table: + response = requests.put(url=endpoint, json={'address': row['address']}, headers={'Content-Type': 'PUT'}) + responses.append(response) + +@given('an invalid building address') +def step_impl(context): + global responses + responses = [] + for row in context.table: + response = requests.put(url=endpoint, json={'address': row['address']}, headers={'Content-Type': 'PUT'}) + responses.append(response) + +@given('a not covered building address') +def step_impl(context): + global responses + responses = [] + for row in context.table: + response = requests.put(url=endpoint, json={'address': row['address']}, headers={'Content-Type': 'PUT'}) + responses.append(response) + +@then('result page will include code "{code}"') +def step_impl(context, code): + for response in responses: + assert code == str(response.status_code) + +@then('result page will include success as "{TrueOrFalse}"') +def step_impl(context, TrueOrFalse): + for response in responses: + assert TrueOrFalse == str(json.loads(response.text)['success']) +