Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor rocketchat tests to remove pytest-bdd #4136

Merged
merged 2 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions api/app/tests/test_rocketchat_notifications.feature

This file was deleted.

20 changes: 4 additions & 16 deletions api/app/tests/test_rocketchat_notifications.py
Original file line number Diff line number Diff line change
@@ -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
Loading