Skip to content

Commit

Permalink
more update
Browse files Browse the repository at this point in the history
  • Loading branch information
cartertinney committed Feb 8, 2024
1 parent 3a581d3 commit 3490af0
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 94 deletions.
2 changes: 1 addition & 1 deletion requirements_test.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pytest
pytest < 8.0.0 # lazy_fixture currently broken in 8
pytest-mock
pytest-asyncio <= 0.16 # Can remove this once Python 3.6 support is dropped
pytest-testdox>=1.1.1
Expand Down
186 changes: 93 additions & 93 deletions tests/unit/iothub/shared_client_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,53 +162,53 @@ def test_product_info_option(

assert config.product_info == product_info

# @pytest.mark.it(
# "Sets the 'ensure_desired_properties' user option parameter on the PipelineConfig, if provided"
# )
# @pytest.mark.parametrize("edp_value", [True, False])
# def test_ensure_desired_properties_option(
# self,
# option_test_required_patching,
# client_create_method,
# create_method_args,
# mock_mqtt_pipeline_init,
# mock_http_pipeline_init,
# edp_value,
# ):

# client_create_method(*create_method_args, ensure_desired_properties=edp_value)

# # Get configuration object, and ensure it was used for both protocol pipelines
# assert mock_mqtt_pipeline_init.call_count == 1
# config = mock_mqtt_pipeline_init.call_args[0][0]
# assert isinstance(config, IoTHubPipelineConfig)
# assert config == mock_http_pipeline_init.call_args[0][0]

# assert config.ensure_desired_properties is edp_value

# @pytest.mark.it(
# "Sets the 'websockets' user option parameter on the PipelineConfig, if provided"
# )
# @pytest.mark.parametrize("ws_value", [True, False])
# def test_websockets_option(
# self,
# option_test_required_patching,
# client_create_method,
# create_method_args,
# mock_mqtt_pipeline_init,
# mock_http_pipeline_init,
# ws_value,
# ):

# client_create_method(*create_method_args, websockets=ws_value)

# # Get configuration object, and ensure it was used for both protocol pipelines
# assert mock_mqtt_pipeline_init.call_count == 1
# config = mock_mqtt_pipeline_init.call_args[0][0]
# assert isinstance(config, IoTHubPipelineConfig)
# assert config == mock_http_pipeline_init.call_args[0][0]

# assert config.websockets is ws_value
@pytest.mark.it(
"Sets the 'ensure_desired_properties' user option parameter on the PipelineConfig, if provided"
)
@pytest.mark.parametrize("edp_value", [True, False])
def test_ensure_desired_properties_option(
self,
option_test_required_patching,
client_create_method,
create_method_args,
mock_mqtt_pipeline_init,
mock_http_pipeline_init,
edp_value,
):

client_create_method(*create_method_args, ensure_desired_properties=edp_value)

# Get configuration object, and ensure it was used for both protocol pipelines
assert mock_mqtt_pipeline_init.call_count == 1
config = mock_mqtt_pipeline_init.call_args[0][0]
assert isinstance(config, IoTHubPipelineConfig)
assert config == mock_http_pipeline_init.call_args[0][0]

assert config.ensure_desired_properties is edp_value

@pytest.mark.it(
"Sets the 'websockets' user option parameter on the PipelineConfig, if provided"
)
@pytest.mark.parametrize("ws_value", [True, False])
def test_websockets_option(
self,
option_test_required_patching,
client_create_method,
create_method_args,
mock_mqtt_pipeline_init,
mock_http_pipeline_init,
ws_value,
):

client_create_method(*create_method_args, websockets=ws_value)

# Get configuration object, and ensure it was used for both protocol pipelines
assert mock_mqtt_pipeline_init.call_count == 1
config = mock_mqtt_pipeline_init.call_args[0][0]
assert isinstance(config, IoTHubPipelineConfig)
assert config == mock_http_pipeline_init.call_args[0][0]

assert config.websockets is ws_value

# TODO: Show that input in the wrong format is formatted to the correct one. This test exists
# in the IoTHubPipelineConfig object already, but we do not currently show that this is felt
Expand Down Expand Up @@ -321,52 +321,52 @@ def test_keep_alive_options(

assert config.keep_alive == keepalive_value

# @pytest.mark.it(
# "Sets the 'auto_connect' user option parameter on the PipelineConfig, if provided"
# )
# @pytest.mark.parametrize("auto_connect_value", [True, False])
# def test_auto_connect_option(
# self,
# option_test_required_patching,
# client_create_method,
# create_method_args,
# mock_mqtt_pipeline_init,
# mock_http_pipeline_init,
# auto_connect_value
# ):
# client_create_method(*create_method_args, auto_connect=auto_connect_value)

# # Get configuration object, and ensure it was used for both protocol pipelines
# assert mock_mqtt_pipeline_init.call_count == 1
# config = mock_mqtt_pipeline_init.call_args[0][0]
# assert isinstance(config, IoTHubPipelineConfig)
# assert config == mock_http_pipeline_init.call_args[0][0]

# assert config.auto_connect == auto_connect_value

# @pytest.mark.it(
# "Sets the 'connection_retry' user option parameter on the PipelineConfig, if provided"
# )
# @pytest.mark.parametrize("connection_retry_value", [True, False])
# def test_connection_retry_option(
# self,
# option_test_required_patching,
# client_create_method,
# create_method_args,
# mock_mqtt_pipeline_init,
# mock_http_pipeline_init,
# connection_retry_value
# ):
# connection_retry_value = False
# client_create_method(*create_method_args, connection_retry=connection_retry_value)

# # Get configuration object, and ensure it was used for both protocol pipelines
# assert mock_mqtt_pipeline_init.call_count == 1
# config = mock_mqtt_pipeline_init.call_args[0][0]
# assert isinstance(config, IoTHubPipelineConfig)
# assert config == mock_http_pipeline_init.call_args[0][0]

# assert config.connection_retry == connection_retry_value
@pytest.mark.it(
"Sets the 'auto_connect' user option parameter on the PipelineConfig, if provided"
)
@pytest.mark.parametrize("auto_connect_value", [True, False])
def test_auto_connect_option(
self,
option_test_required_patching,
client_create_method,
create_method_args,
mock_mqtt_pipeline_init,
mock_http_pipeline_init,
auto_connect_value,
):
client_create_method(*create_method_args, auto_connect=auto_connect_value)

# Get configuration object, and ensure it was used for both protocol pipelines
assert mock_mqtt_pipeline_init.call_count == 1
config = mock_mqtt_pipeline_init.call_args[0][0]
assert isinstance(config, IoTHubPipelineConfig)
assert config == mock_http_pipeline_init.call_args[0][0]

assert config.auto_connect == auto_connect_value

@pytest.mark.it(
"Sets the 'connection_retry' user option parameter on the PipelineConfig, if provided"
)
@pytest.mark.parametrize("connection_retry_value", [True, False])
def test_connection_retry_option(
self,
option_test_required_patching,
client_create_method,
create_method_args,
mock_mqtt_pipeline_init,
mock_http_pipeline_init,
connection_retry_value,
):
connection_retry_value = False
client_create_method(*create_method_args, connection_retry=connection_retry_value)

# Get configuration object, and ensure it was used for both protocol pipelines
assert mock_mqtt_pipeline_init.call_count == 1
config = mock_mqtt_pipeline_init.call_args[0][0]
assert isinstance(config, IoTHubPipelineConfig)
assert config == mock_http_pipeline_init.call_args[0][0]

assert config.connection_retry == connection_retry_value

@pytest.mark.it(
"Sets the 'connection_retry_interval' user option parameter on the PipelineConfig, if provided"
Expand Down

0 comments on commit 3490af0

Please sign in to comment.