Skip to content

Commit

Permalink
Update opensearch_external_url_formatter_test.py
Browse files Browse the repository at this point in the history
  • Loading branch information
luffynextgen authored Nov 17, 2023
1 parent 4f44d05 commit c2ad286
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions tests/opensearch_external_url_formatter_test.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,9 @@
from typing import Any
import os
import pytest

import requests
from requests.auth import AuthBase, HTTPBasicAuth

from elastalert.opensearch_external_url_formatter import AbsoluteOpensearchExternalUrlFormatter
from elastalert.opensearch_external_url_formatter import OpensearchExternalUrlFormatter
from elastalert.opensearch_external_url_formatter import create_opensearch_external_url_formatter

from elastalert.auth import RefeshableAWSRequestsAuth
from elastalert.util import EAException

from unittest import mock


class AbsoluteFormatTestCase:
def __init__(
self,
Expand Down Expand Up @@ -46,3 +35,13 @@ def test_absolute_opensearch_external_url_formatter(
actualUrl = formatter.format(test_case.relative_url)
print(actualUrl)
assert actualUrl == test_case.expected_url


def test_create_opensearch_external_url_formatter_without_shortening():
formatter = create_opensearch_external_url_formatter(
rule={
'opensearch_url': 'http://opensearch.test.org/'
},
)
assert type(formatter) is AbsoluteOpensearchExternalUrlFormatter
assert formatter.base_url == 'http://opensearch.test.org/'

0 comments on commit c2ad286

Please sign in to comment.