Skip to content

Commit

Permalink
Add more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
stveit committed Nov 6, 2023
1 parent d51b62e commit 9659a76
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/unittests/portadmin/napalm/juniper_poe_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,22 @@ def test_returns_correct_states_if_input_has_multiple_interfaces(
assert return_dict[interface1_mock.ifname] == Juniper.POE_ENABLED
assert return_dict[interface2_mock.ifname] == Juniper.POE_DISABLED

def test_returns_none_for_single_interface_that_does_not_support_poe(
self, handler_mock, interface1_mock
):
handler_mock._get_single_poe_state = Mock(side_effect=POENotSupportedError)
return_dict = handler_mock.get_poe_states([interface1_mock])
assert return_dict[interface1_mock.ifname] is None

def test_returns_none_for_multiple_interfaces_that_does_not_support_poe(
self, handler_mock, interface1_mock, interface2_mock
):
bulk_return_dict = {interface1_mock.ifname: None, interface2_mock.ifname: None}
handler_mock._get_poe_states_bulk = Mock(return_value=bulk_return_dict)
return_dict = handler_mock.get_poe_states([interface1_mock, interface2_mock])
assert return_dict[interface1_mock.ifname] is None
assert return_dict[interface2_mock.ifname] is None


class TestGetSinglePoeState:
def test_returns_correct_state_for_interface_that_exists_in_xml_response(
Expand Down

0 comments on commit 9659a76

Please sign in to comment.