Skip to content

Commit

Permalink
rename class CloudwatchLogsQueryService --> CloudwatchService
Browse files Browse the repository at this point in the history
  • Loading branch information
joefong-nhs committed Jun 11, 2024
1 parent 84870fc commit e89ed8c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
logger = LoggingService(__name__)


class CloudwatchLogsQueryService:
class CloudwatchService:
def __init__(self):
self.logs_client = boto3.client("logs")
self.workspace = os.environ["WORKSPACE"]
Expand Down
6 changes: 3 additions & 3 deletions lambdas/services/data_collection_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
RecordStoreData,
StatisticData,
)
from services.base.cloudwatch_logs_query_service import CloudwatchLogsQueryService
from services.base.cloudwatch_service import CloudwatchService
from services.base.dynamo_service import DynamoDBService
from services.base.s3_service import S3Service
from utils.audit_logging_setup import LoggingService
Expand Down Expand Up @@ -41,7 +41,7 @@ def __init__(self):
self.workspace = os.environ["WORKSPACE"]
self.output_table_name = os.environ["STATISTICS_TABLE"]

self.logs_query_service = CloudwatchLogsQueryService()
self.cloudwatch_service = CloudwatchService()
self.dynamodb_service = DynamoDBService()
self.s3_service = S3Service()

Expand Down Expand Up @@ -218,7 +218,7 @@ def get_active_user_list(self) -> dict[str, list]:
def get_cloud_watch_query_result(
self, query_params: CloudwatchLogsQueryParams
) -> list[dict]:
return self.logs_query_service.query_logs(
return self.cloudwatch_service.query_logs(
query_params=query_params,
start_time=self.collection_start_time,
end_time=self.collection_end_time,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from services.base.cloudwatch_logs_query_service import CloudwatchLogsQueryService
from services.base.cloudwatch_service import CloudwatchService
from tests.unit.conftest import WORKSPACE
from tests.unit.helpers.data.statistic.mock_logs_query_results import (
EXPECTED_QUERY_RESULT,
Expand All @@ -24,7 +24,7 @@

@pytest.fixture
def mock_service(set_env, mock_logs_client, patch_sleep):
service = CloudwatchLogsQueryService()
service = CloudwatchService()
yield service


Expand Down
6 changes: 3 additions & 3 deletions lambdas/tests/unit/services/test_data_collection_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import pytest
from freezegun import freeze_time
from pytest_unordered import unordered
from services.base.cloudwatch_logs_query_service import CloudwatchLogsQueryService
from services.base.cloudwatch_service import CloudwatchService
from services.base.dynamo_service import DynamoDBService
from services.base.s3_service import S3Service
from services.data_collection_service import DataCollectionService
Expand Down Expand Up @@ -101,8 +101,8 @@ def mock_implementation(query_params: CloudwatchLogsQueryParams, **_kwargs):
return MOCK_UNIQUE_ACTIVE_USER_IDS

patched_instance = mocker.patch(
"services.data_collection_service.CloudwatchLogsQueryService",
spec=CloudwatchLogsQueryService,
"services.data_collection_service.CloudwatchService",
spec=CloudwatchService,
).return_value
mocked_method = patched_instance.query_logs
mocked_method.side_effect = mock_implementation
Expand Down

0 comments on commit e89ed8c

Please sign in to comment.