Skip to content
Open
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
30 changes: 15 additions & 15 deletions parsers/commands/activate_parser_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

from click import testing

from google3.third_party.chronicle.cli import mock_test_utility
from mock_test_utility import MockResponse
from parsers import url
from parsers.commands import activate_parser
from parsers.tests.fixtures import * # pylint: disable=wildcard-import
Expand All @@ -41,13 +41,13 @@
def test_activate_parser(
mock_get_dataplane_url: mock.MagicMock,
mock_http_session: mock.MagicMock,
test_data_activate_parser: mock_test_utility.MockResponse) -> None:
test_data_activate_parser: MockResponse) -> None:
"""Test case to check response for activate parser.

Args:
mock_get_dataplane_url (mock.MagicMock): Mock object
mock_http_session (mock.MagicMock): Mock object
test_data_activate_parser (mock_test_utility.MockResponse): Test input data
test_data_activate_parser (MockResponse): Test input data
"""
mock_get_dataplane_url.return_value = ACTIVATE_URL
client = mock.Mock()
Expand All @@ -68,13 +68,13 @@ def test_activate_parser(
def test_activate_parser_v2_flag_not_provided(
mock_get_dataplane_url: mock.MagicMock,
mock_http_session: mock.MagicMock,
test_v2flag_not_provided: mock_test_utility.MockResponse) -> None:
test_v2flag_not_provided: MockResponse) -> None:
"""Test case to check response for v2 flag not provided.

Args:
mock_get_dataplane_url (mock.MagicMock): Mock object
mock_http_session (mock.MagicMock): Mock object
test_v2flag_not_provided (mock_test_utility.MockResponse): Test input data
test_v2flag_not_provided (MockResponse): Test input data
"""
mock_get_dataplane_url.return_value = ACTIVATE_URL
client = mock.Mock()
Expand All @@ -92,13 +92,13 @@ def test_activate_parser_v2_flag_not_provided(
def test_activate_parser_empty_project_id(
mock_get_dataplane_url: mock.MagicMock,
mock_http_session: mock.MagicMock,
test_empty_project_id: mock_test_utility.MockResponse) -> None:
test_empty_project_id: MockResponse) -> None:
"""Test case to check response for empty Project ID.

Args:
mock_get_dataplane_url (mock.MagicMock): Mock object
mock_http_session (mock.MagicMock): Mock object
test_empty_project_id (mock_test_utility.MockResponse): Test input data
test_empty_project_id (MockResponse): Test input data
"""
mock_get_dataplane_url.return_value = ACTIVATE_URL
client = mock.Mock()
Expand All @@ -117,13 +117,13 @@ def test_activate_parser_empty_project_id(
def test_activate_parser_empty_customer_id(
mock_get_dataplane_url: mock.MagicMock,
mock_http_session: mock.MagicMock,
test_empty_customer_id: mock_test_utility.MockResponse) -> None:
test_empty_customer_id: MockResponse) -> None:
"""Test case to check response for empty Customer ID.

Args:
mock_get_dataplane_url (mock.MagicMock): Mock object
mock_http_session (mock.MagicMock): Mock object
test_empty_customer_id (mock_test_utility.MockResponse): Test input data
test_empty_customer_id (MockResponse): Test input data
"""
mock_get_dataplane_url.return_value = ACTIVATE_URL
client = mock.Mock()
Expand All @@ -143,13 +143,13 @@ def test_activate_parser_empty_customer_id(
def test_activate_parser_empty_log_type(
mock_get_dataplane_url: mock.MagicMock,
mock_http_session: mock.MagicMock,
test_empty_log_type: mock_test_utility.MockResponse) -> None:
test_empty_log_type: MockResponse) -> None:
"""Test case to check response for empty Log Type.

Args:
mock_get_dataplane_url (mock.MagicMock): Mock object
mock_http_session (mock.MagicMock): Mock object
test_empty_log_type (mock_test_utility.MockResponse): Test input data
test_empty_log_type (MockResponse): Test input data
"""
mock_get_dataplane_url.return_value = ACTIVATE_URL
client = mock.Mock()
Expand All @@ -169,13 +169,13 @@ def test_activate_parser_empty_log_type(
def test_activate_parser_empty_parser_id(
mock_get_dataplane_url: mock.MagicMock,
mock_http_session: mock.MagicMock,
test_empty_parser_id: mock_test_utility.MockResponse) -> None:
test_empty_parser_id: MockResponse) -> None:
"""Test case to check response for empty Parser ID.

Args:
mock_get_dataplane_url (mock.MagicMock): Mock object
mock_http_session (mock.MagicMock): Mock object
test_empty_parser_id (mock_test_utility.MockResponse): Test input data
test_empty_parser_id (MockResponse): Test input data
"""
mock_get_dataplane_url.return_value = ACTIVATE_URL
client = mock.Mock()
Expand All @@ -195,13 +195,13 @@ def test_activate_parser_empty_parser_id(
def test_activate_parser_500(
mock_get_dataplane_url: mock.MagicMock,
mock_http_session: mock.MagicMock,
test_500_resp: mock_test_utility.MockResponse) -> None:
test_500_resp: MockResponse) -> None:
"""Test case to check response for activate parser for 500 response code.

Args:
mock_get_dataplane_url (mock.MagicMock): Mock object
mock_http_session (mock.MagicMock): Mock object
test_500_resp (mock_test_utility.MockResponse): Test input data
test_500_resp (MockResponse): Test input data
"""
mock_get_dataplane_url.return_value = ACTIVATE_URL
client = mock.Mock()
Expand Down
28 changes: 14 additions & 14 deletions parsers/commands/classify_log_type_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

from click import testing

from google3.third_party.chronicle.cli import mock_test_utility
from mock_test_utility import MockResponse
from parsers import url
from parsers.commands import classify_log_type
from parsers.tests.fixtures import * # pylint: disable=wildcard-import
Expand Down Expand Up @@ -47,15 +47,15 @@ def test_classify_log_type(
mock_get_dataplane_url: mock.MagicMock,
mock_http_session: mock.MagicMock,
mock_time: mock.MagicMock,
test_data_classify_log_type: mock_test_utility.MockResponse,
test_data_classify_log_type: MockResponse,
) -> None:
"""Test case to check success response.

Args:
mock_get_dataplane_url (mock.MagicMock): Mock object
mock_http_session (mock.MagicMock): Mock object
mock_time (mock.MagicMock): Mock object
test_data_classify_log_type (mock_test_utility.MockResponse): Test input
test_data_classify_log_type (MockResponse): Test input
data
"""
mock_time.return_value = 0.0
Expand Down Expand Up @@ -92,14 +92,14 @@ def test_classify_log_type(
def test_classify_log_type_v2_flag_not_provided(
mock_get_dataplane_url: mock.MagicMock,
mock_http_session: mock.MagicMock,
test_v2flag_not_provided: mock_test_utility.MockResponse,
test_v2flag_not_provided: MockResponse,
) -> None:
"""Test case to check response for v2 flag not provided.

Args:
mock_get_dataplane_url (mock.MagicMock): Mock object
mock_http_session (mock.MagicMock): Mock object
test_v2flag_not_provided (mock_test_utility.MockResponse): Test input data
test_v2flag_not_provided (MockResponse): Test input data
"""
mock_get_dataplane_url.return_value = CLASSIFY_LOG_TYPE_URL
client = mock.Mock()
Expand All @@ -119,14 +119,14 @@ def test_classify_log_type_v2_flag_not_provided(
def test_classify_log_type_empty_project_id(
mock_get_dataplane_url: mock.MagicMock,
mock_http_session: mock.MagicMock,
test_empty_project_id: mock_test_utility.MockResponse,
test_empty_project_id: MockResponse,
) -> None:
"""Test case to check response for empty Project ID.

Args:
mock_get_dataplane_url (mock.MagicMock): Mock object
mock_http_session (mock.MagicMock): Mock object
test_empty_project_id (mock_test_utility.MockResponse): Test input data
test_empty_project_id (MockResponse): Test input data
"""
mock_get_dataplane_url.return_value = CLASSIFY_LOG_TYPE_URL
client = mock.Mock()
Expand All @@ -147,14 +147,14 @@ def test_classify_log_type_empty_project_id(
def test_classify_log_type_empty_customer_id(
mock_get_dataplane_url: mock.MagicMock,
mock_http_session: mock.MagicMock,
test_empty_customer_id: mock_test_utility.MockResponse,
test_empty_customer_id: MockResponse,
) -> None:
"""Test case to check response for empty Customer ID.

Args:
mock_get_dataplane_url (mock.MagicMock): Mock object
mock_http_session (mock.MagicMock): Mock object
test_empty_customer_id (mock_test_utility.MockResponse): Test input data
test_empty_customer_id (MockResponse): Test input data
"""
mock_get_dataplane_url.return_value = CLASSIFY_LOG_TYPE_URL
client = mock.Mock()
Expand All @@ -175,14 +175,14 @@ def test_classify_log_type_empty_customer_id(
def test_classify_log_type_non_existing_log_file(
mock_get_dataplane_url: mock.MagicMock,
mock_http_session: mock.MagicMock,
test_data_non_existing_log_file: mock_test_utility.MockResponse,
test_data_non_existing_log_file: MockResponse,
) -> None:
"""Test case to check response for non existing log file.

Args:
mock_get_dataplane_url (mock.MagicMock): Mock object
mock_http_session (mock.MagicMock): Mock object
test_data_non_existing_log_file (mock_test_utility.MockResponse): Test input
test_data_non_existing_log_file (MockResponse): Test input
data
"""
mock_get_dataplane_url.return_value = CLASSIFY_LOG_TYPE_URL
Expand Down Expand Up @@ -223,7 +223,7 @@ def test_classify_log_type_empty_response(
mock_get_dataplane_url.return_value = CLASSIFY_LOG_TYPE_URL
client = mock.Mock()
client.request.side_effect = [
mock_test_utility.MockResponse(status_code=200, text="""{}""")
MockResponse(status_code=200, text="""{}""")
]
mock_http_session.return_value = client
result = runner.invoke(
Expand Down Expand Up @@ -252,14 +252,14 @@ def test_classify_log_type_empty_response(
def test_classify_log_type_500(
mock_get_dataplane_url: mock.MagicMock,
mock_http_session: mock.MagicMock,
test_500_resp: mock_test_utility.MockResponse,
test_500_resp: MockResponse,
) -> None:
"""Test case to check response for 500 response code.

Args:
mock_get_dataplane_url (mock.MagicMock): Mock object
mock_http_session (mock.MagicMock): Mock object
test_500_resp (mock_test_utility.MockResponse): Test input data
test_500_resp (MockResponse): Test input data
"""
create_temp_log_file(TEMP_SUBMIT_LOG_FILE, "test_log1\ntest_log2")
mock_get_dataplane_url.return_value = CLASSIFY_LOG_TYPE_URL
Expand Down
30 changes: 15 additions & 15 deletions parsers/commands/deactivate_parser_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

from click import testing

from google3.third_party.chronicle.cli import mock_test_utility
from mock_test_utility import MockResponse
from parsers import url
from parsers.commands import deactivate_parser
from parsers.tests.fixtures import * # pylint: disable=wildcard-import
Expand All @@ -42,13 +42,13 @@
def test_deactivate_parser(
mock_get_dataplane_url: mock.MagicMock,
mock_http_session: mock.MagicMock,
test_data_deactivate_parser: mock_test_utility.MockResponse) -> None:
test_data_deactivate_parser: MockResponse) -> None:
"""Test case to check response for deactivate parser.

Args:
mock_get_dataplane_url (mock.MagicMock): Mock object
mock_http_session (mock.MagicMock): Mock object
test_data_deactivate_parser (mock_test_utility.MockResponse): Test input
test_data_deactivate_parser (MockResponse): Test input
data
"""
mock_get_dataplane_url.return_value = DEACTIVATE_URL
Expand All @@ -70,13 +70,13 @@ def test_deactivate_parser(
def test_activate_parser_v2_flag_not_provided(
mock_get_dataplane_url: mock.MagicMock,
mock_http_session: mock.MagicMock,
test_v2flag_not_provided: mock_test_utility.MockResponse) -> None:
test_v2flag_not_provided: MockResponse) -> None:
"""Test case to check response for v2 flag not provided.

Args:
mock_get_dataplane_url (mock.MagicMock): Mock object
mock_http_session (mock.MagicMock): Mock object
test_v2flag_not_provided (mock_test_utility.MockResponse): Test input data
test_v2flag_not_provided (MockResponse): Test input data
"""
mock_get_dataplane_url.return_value = DEACTIVATE_URL
client = mock.Mock()
Expand All @@ -94,13 +94,13 @@ def test_activate_parser_v2_flag_not_provided(
def test_deactivate_parser_empty_project_id(
mock_get_dataplane_url: mock.MagicMock,
mock_http_session: mock.MagicMock,
test_empty_project_id: mock_test_utility.MockResponse) -> None:
test_empty_project_id: MockResponse) -> None:
"""Test case to check response for empty Project ID.

Args:
mock_get_dataplane_url (mock.MagicMock): Mock object
mock_http_session (mock.MagicMock): Mock object
test_empty_project_id (mock_test_utility.MockResponse): Test input data
test_empty_project_id (MockResponse): Test input data
"""
mock_get_dataplane_url.return_value = DEACTIVATE_URL
client = mock.Mock()
Expand All @@ -119,13 +119,13 @@ def test_deactivate_parser_empty_project_id(
def test_deactivate_parser_empty_customer_id(
mock_get_dataplane_url: mock.MagicMock,
mock_http_session: mock.MagicMock,
test_empty_customer_id: mock_test_utility.MockResponse) -> None:
test_empty_customer_id: MockResponse) -> None:
"""Test case to check response for empty Customer ID.

Args:
mock_get_dataplane_url (mock.MagicMock): Mock object
mock_http_session (mock.MagicMock): Mock object
test_empty_customer_id (mock_test_utility.MockResponse): Test input data
test_empty_customer_id (MockResponse): Test input data
"""
mock_get_dataplane_url.return_value = DEACTIVATE_URL
client = mock.Mock()
Expand All @@ -145,13 +145,13 @@ def test_deactivate_parser_empty_customer_id(
def test_deactivate_parser_empty_log_type(
mock_get_dataplane_url: mock.MagicMock,
mock_http_session: mock.MagicMock,
test_empty_log_type: mock_test_utility.MockResponse) -> None:
test_empty_log_type: MockResponse) -> None:
"""Test case to check response for empty Log Type.

Args:
mock_get_dataplane_url (mock.MagicMock): Mock object
mock_http_session (mock.MagicMock): Mock object
test_empty_log_type (mock_test_utility.MockResponse): Test input data
test_empty_log_type (MockResponse): Test input data
"""
mock_get_dataplane_url.return_value = DEACTIVATE_URL
client = mock.Mock()
Expand All @@ -171,13 +171,13 @@ def test_deactivate_parser_empty_log_type(
def test_deactivate_parser_empty_parser_id(
mock_get_dataplane_url: mock.MagicMock,
mock_http_session: mock.MagicMock,
test_empty_parser_id: mock_test_utility.MockResponse) -> None:
test_empty_parser_id: MockResponse) -> None:
"""Test case to check response for empty Parser ID.

Args:
mock_get_dataplane_url (mock.MagicMock): Mock object
mock_http_session (mock.MagicMock): Mock object
test_empty_parser_id (mock_test_utility.MockResponse): Test input data
test_empty_parser_id (MockResponse): Test input data
"""
mock_get_dataplane_url.return_value = DEACTIVATE_URL
client = mock.Mock()
Expand All @@ -197,13 +197,13 @@ def test_deactivate_parser_empty_parser_id(
def test_deactivate_parser_500(
mock_get_dataplane_url: mock.MagicMock,
mock_http_session: mock.MagicMock,
test_500_resp: mock_test_utility.MockResponse) -> None:
test_500_resp: MockResponse) -> None:
"""Test case to check response for deactivate parser for 500 response code.

Args:
mock_get_dataplane_url (mock.MagicMock): Mock object
mock_http_session (mock.MagicMock): Mock object
test_500_resp (mock_test_utility.MockResponse): Test input data
test_500_resp (MockResponse): Test input data
"""
mock_get_dataplane_url.return_value = DEACTIVATE_URL
client = mock.Mock()
Expand Down
Loading