fixed SP unit tests.
@@ -2247,6 +2247,9 @@ class TestSendingProcess:
async def mock_stat_key():
return "sp"
+ async def mock_master_stat_key():
+ return 'Readings Sent'
+
with patch.object(SilentArgParse, 'silent_arg_parse', side_effect=['corehost', 0, 'sname']):
with patch.object(MicroserviceManagementClient, '__init__', return_value=None) as mmc_patch:
with patch.object(ReadingsStorageClientAsync, '__init__', return_value=None) as rsc_async_patch:
@@ -2263,6 +2266,7 @@ class TestSendingProcess:
with patch.object(sp, '_get_stream_id', return_value=mock_stream()) as mocked_get_stream_id:
with patch.object(sp, '_get_statistics_key', return_value=mock_stat_key()) as mocked_get_statistics_key:
+ with patch.object(sp, '_get_master_statistics_key', return_value=mock_master_stat_key()):
with patch.object(sp._core_microservice_management_client, 'update_configuration_item'):
with patch.object(sp, '_retrieve_configuration'):
with patch.object(sp, '_plugin_load') as mocked_plugin_load:
@@ -2280,6 +2284,9 @@ class TestSendingProcess:
async def mock_stat_key():
return "sp"
+ async def mock_master_stat_key():
+ return 'Readings Sent'
+
with patch.object(SilentArgParse, 'silent_arg_parse', side_effect=['corehost', 0, 'sname']):
with patch.object(MicroserviceManagementClient, '__init__', return_value=None) as mmc_patch:
with patch.object(ReadingsStorageClientAsync, '__init__', return_value=None) as rsc_async_patch:
@@ -2297,6 +2304,7 @@ class TestSendingProcess:
with patch.object(sp._core_microservice_management_client, 'update_configuration_item'):
with patch.object(sp, '_get_stream_id', return_value=mock_stream()) as mocked_get_stream_id:
with patch.object(sp, '_get_statistics_key', return_value=mock_stat_key()) as mocked_get_statistics_key:
+ with patch.object(sp, '_get_master_statistics_key', return_value=mock_master_stat_key()):
with patch.object(sp, '_retrieve_configuration'):
with patch.object(sp, '_plugin_load') as mocked_plugin_load:
with patch.object(sp._plugin, 'plugin_info') as mocked_plugin_info:
@@ -2317,6 +2325,9 @@ class TestSendingProcess:
async def mock_stat_key():
return "sp"
+ async def mock_master_stat_key():
+ return 'Readings Sent'
+
with patch.object(SilentArgParse, 'silent_arg_parse', side_effect=['corehost', 0, 'sname']):
with patch.object(MicroserviceManagementClient, '__init__', return_value=None) as mmc_patch:
with patch.object(ReadingsStorageClientAsync, '__init__', return_value=None) as rsc_async_patch:
@@ -2334,6 +2345,7 @@ class TestSendingProcess:
with patch.object(sp._core_microservice_management_client, 'update_configuration_item'):
with patch.object(sp, '_get_stream_id', return_value=mock_stream()) as mocked_get_stream_id:
with patch.object(sp, '_get_statistics_key', return_value=mock_stat_key()) as mocked_get_statistics_key:
+ with patch.object(sp, '_get_master_statistics_key', return_value=mock_master_stat_key()):
with patch.object(sp, '_retrieve_configuration') as mocked_retrieve_configuration:
with patch.object(sp, '_plugin_load') as mocked_plugin_load:
with patch.object(sp._plugin, 'plugin_info') as mocked_plugin_info:
