Example #1
0
 def test_constructor_client_command_buffer_instantiated():
     client_command_buffer_mock = MagicMock()
     with patch("gsy_e_sdk.aggregator.ClientCommandBuffer",
                return_value=client_command_buffer_mock) as mocked_class:
         agg = Aggregator(aggregator_name=TEST_AGGREGATOR_NAME)
         mocked_class.assert_called()
         assert agg._client_command_buffer is client_command_buffer_mock
Example #2
0
 def test_add_to_batch_commands_returns_client_command_buffer():
     client_command_buffer_mock = MagicMock()
     with patch("gsy_e_sdk.aggregator.ClientCommandBuffer",
                return_value=client_command_buffer_mock):
         agg = Aggregator(aggregator_name=TEST_AGGREGATOR_NAME)
         buffer_instance = agg.add_to_batch_commands
         assert buffer_instance == client_command_buffer_mock
Example #3
0
 def test_constructor_grid_fee_calculation_instantiated():
     grid_fee_calc_mock = MagicMock()
     with patch("gsy_e_sdk.aggregator.GridFeeCalculation",
                return_value=grid_fee_calc_mock) as mocked_class:
         agg = Aggregator(aggregator_name=TEST_AGGREGATOR_NAME)
         mocked_class.assert_called()
         assert agg.grid_fee_calculation is grid_fee_calc_mock
Example #4
0
 def test_constructor_accept_all_devices_setup(accept):
     agg = Aggregator(aggregator_name=TEST_AGGREGATOR_NAME,
                      accept_all_devices=accept)
     assert agg.accept_all_devices == accept
Example #5
0
 def test_constructor_websockets_domain_name_setup(set_value,
                                                   expected_set_val):
     # this attribute is inherited from rest_asset_client
     agg = Aggregator(aggregator_name=TEST_AGGREGATOR_NAME,
                      websockets_domain_name=set_value)
     assert agg.websockets_domain_name == expected_set_val
Example #6
0
 def test_constructor_simulation_id_setup(set_value, expected_set_val):
     # this attribute is inherited from rest_asset_client
     agg = Aggregator(aggregator_name=TEST_AGGREGATOR_NAME,
                      simulation_id=set_value)
     assert agg.simulation_id == expected_set_val
Example #7
0
def fixture_aggregator(mock_outgoing_funcs_in_construction):  # pylint: disable=unused-argument
    return Aggregator(
        aggregator_name=TEST_AGGREGATOR_NAME,
        simulation_id=TEST_SIMULATION["uuid"],
        domain_name=TEST_SIMULATION["domain_name"],
        websockets_domain_name=TEST_SIMULATION["websockets_domain_name"])