From 608544464abea0e40a661d8cb2e6b06ce3271574 Mon Sep 17 00:00:00 2001 From: Conor Brady Date: Mon, 25 Nov 2024 15:48:40 -0800 Subject: [PATCH] Refactor HFI endpoint tests remove pytest-bdd --- .../test_rocketchat_notifications.feature | 9 --------- .../tests/test_rocketchat_notifications.py | 20 ++++--------------- 2 files changed, 4 insertions(+), 25 deletions(-) delete mode 100644 api/app/tests/test_rocketchat_notifications.feature diff --git a/api/app/tests/test_rocketchat_notifications.feature b/api/app/tests/test_rocketchat_notifications.feature deleted file mode 100644 index 849d052e5..000000000 --- a/api/app/tests/test_rocketchat_notifications.feature +++ /dev/null @@ -1,9 +0,0 @@ -Feature: Rocketchat Notifications - - Scenario: Send automated notification to Rocketchat channel - Given a specified and an - Then the response should indicate success - - Examples: - | message_string | exception | success_boolean | - | This is an automated unit test for rocketchat_notifications. | General exception message | True | \ No newline at end of file diff --git a/api/app/tests/test_rocketchat_notifications.py b/api/app/tests/test_rocketchat_notifications.py index d2afc8e8a..1dd582226 100644 --- a/api/app/tests/test_rocketchat_notifications.py +++ b/api/app/tests/test_rocketchat_notifications.py @@ -1,20 +1,8 @@ -""" BDD tests for rocketchat_notifications.py """ -from pytest_bdd import scenario, given, then, parsers +"""Tests for rocketchat_notifications.py""" + from app.rocketchat_notifications import send_rocketchat_notification -@scenario('test_rocketchat_notifications.feature', 'Send automated notification to Rocketchat channel') def test_rocketchat_notifications(): - """ BDD Scenario. """ - - -@given(parsers.parse('a specified {message_string} and an {exception}'), target_fixture='response') -def given_message(message_string: str, exception: str): - """ Send the message to the Rocketchat channel using configured auth. """ - return send_rocketchat_notification(message_string, Exception(exception)) - - -@then(parsers.parse('the response should indicate success {success_boolean}')) -def assert_success_boolean(response, success_boolean): - """ Assert the value in the response json for key 'success' matches success_boolean """ - assert str(response['success']) == success_boolean + response = send_rocketchat_notification("This is an automated unit test for rocketchat_notifications.", Exception("General exception message")) + assert response["success"] == True