mirror of
https://github.com/ansible/awx.git
synced 2026-05-09 18:37:36 -02:30
Fix rocket.chat notification test flake8
Signed-off-by: Jeandre Le Roux <theblazehen@theblazehen.com>
This commit is contained in:
@@ -1,9 +1,9 @@
|
|||||||
import mock
|
import mock
|
||||||
import pytest
|
|
||||||
from django.core.mail.message import EmailMessage
|
from django.core.mail.message import EmailMessage
|
||||||
|
|
||||||
import awx.main.notifications.rocketchat_backend as rocketchat_backend
|
import awx.main.notifications.rocketchat_backend as rocketchat_backend
|
||||||
|
|
||||||
|
|
||||||
def test_send_messages():
|
def test_send_messages():
|
||||||
with mock.patch('awx.main.notifications.rocketchat_backend.requests') as requests_mock:
|
with mock.patch('awx.main.notifications.rocketchat_backend.requests') as requests_mock:
|
||||||
backend = rocketchat_backend.RocketChatBackend()
|
backend = rocketchat_backend.RocketChatBackend()
|
||||||
@@ -12,6 +12,7 @@ def test_send_messages():
|
|||||||
requests_mock.post.assert_called_once_with('http://example.com', data='{"text": "test subject"}', verify=True)
|
requests_mock.post.assert_called_once_with('http://example.com', data='{"text": "test subject"}', verify=True)
|
||||||
assert sent_messages == 1
|
assert sent_messages == 1
|
||||||
|
|
||||||
|
|
||||||
def test_send_messages_with_username():
|
def test_send_messages_with_username():
|
||||||
with mock.patch('awx.main.notifications.rocketchat_backend.requests') as requests_mock:
|
with mock.patch('awx.main.notifications.rocketchat_backend.requests') as requests_mock:
|
||||||
backend = rocketchat_backend.RocketChatBackend(rocketchat_username='testuser')
|
backend = rocketchat_backend.RocketChatBackend(rocketchat_username='testuser')
|
||||||
@@ -20,6 +21,7 @@ def test_send_messages_with_username():
|
|||||||
requests_mock.post.assert_called_once_with('http://example.com', data='{"username": "testuser", "text": "test subject"}', verify=True)
|
requests_mock.post.assert_called_once_with('http://example.com', data='{"username": "testuser", "text": "test subject"}', verify=True)
|
||||||
assert sent_messages == 1
|
assert sent_messages == 1
|
||||||
|
|
||||||
|
|
||||||
def test_send_messages_with_icon_url():
|
def test_send_messages_with_icon_url():
|
||||||
with mock.patch('awx.main.notifications.rocketchat_backend.requests') as requests_mock:
|
with mock.patch('awx.main.notifications.rocketchat_backend.requests') as requests_mock:
|
||||||
backend = rocketchat_backend.RocketChatBackend(rocketchat_icon_url='http://example.com')
|
backend = rocketchat_backend.RocketChatBackend(rocketchat_icon_url='http://example.com')
|
||||||
@@ -28,6 +30,7 @@ def test_send_messages_with_icon_url():
|
|||||||
requests_mock.post.assert_called_once_with('http://example.com', data='{"text": "test subject", "icon_url": "http://example.com"}', verify=True)
|
requests_mock.post.assert_called_once_with('http://example.com', data='{"text": "test subject", "icon_url": "http://example.com"}', verify=True)
|
||||||
assert sent_messages == 1
|
assert sent_messages == 1
|
||||||
|
|
||||||
|
|
||||||
def test_send_messages_with_no_verify_ssl():
|
def test_send_messages_with_no_verify_ssl():
|
||||||
with mock.patch('awx.main.notifications.rocketchat_backend.requests') as requests_mock:
|
with mock.patch('awx.main.notifications.rocketchat_backend.requests') as requests_mock:
|
||||||
backend = rocketchat_backend.RocketChatBackend(rocketchat_no_verify_ssl=True)
|
backend = rocketchat_backend.RocketChatBackend(rocketchat_no_verify_ssl=True)
|
||||||
|
|||||||
Reference in New Issue
Block a user