Skip to content

Commit

Permalink
Merge pull request #150 from epage/term
Browse files Browse the repository at this point in the history
tests(Session): Add failure tests to terminal connections
  • Loading branch information
epage committed Jul 27, 2017
2 parents 1f14f8b + deac6ca commit b8e8f09
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions tests/test_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,3 +403,41 @@ def test_wait_for_intf_remote_wakeup(nixnet_in_interface, nixnet_out_interface):

# Add a successful wait_for_intf_remote_wakeup (frame written to
# output_session causes the input_session to wake up).


@pytest.mark.integration
def test_connect_terminals_failures(nixnet_in_interface):
"""Verifies connect_terminals fails when expected to."""
database_name = 'NIXNET_example'
cluster_name = 'CAN_Cluster'
frame_name = 'CANEventFrame1'

with nixnet.FrameInQueuedSession(
nixnet_in_interface,
database_name,
cluster_name,
frame_name) as input_session:
with pytest.raises(errors.XnetError) as excinfo:
input_session.connect_terminals("FrontPanel0", "FrontPanel1")
assert excinfo.value.error_type in [
constants.Err.SYNCHRONIZATION_NOT_ALLOWED,
constants.Err.INVALID_SYNCHRONIZATION_COMBINATION]


@pytest.mark.integration
def test_disconnect_terminals_failures(nixnet_in_interface):
"""Verifies disconnect_terminals fails when expected to."""
database_name = 'NIXNET_example'
cluster_name = 'CAN_Cluster'
frame_name = 'CANEventFrame1'

with nixnet.FrameInQueuedSession(
nixnet_in_interface,
database_name,
cluster_name,
frame_name) as input_session:
with pytest.raises(errors.XnetError) as excinfo:
input_session.disconnect_terminals("FrontPanel0", "FrontPanel1")
assert excinfo.value.error_type in [
constants.Err.SYNCHRONIZATION_NOT_ALLOWED,
constants.Err.INVALID_SYNCHRONIZATION_COMBINATION]

0 comments on commit b8e8f09

Please sign in to comment.