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 1f78f3e commit d51b62e
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/unittests/portadmin/napalm/juniper_poe_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,28 @@ def test_interfaces_from_db_is_used_if_input_is_empty(self, handler_mock, xml_bu
for interface in expected_interfaces:
assert interface.ifname in return_dict

def test_returns_empty_dict_if_no_input_and_no_interfaces_in_db(
self, handler_mock, xml_bulk
):
handler_mock.netbox.interfaces = []
return_dict = handler_mock.get_poe_states()
assert return_dict == {}

def test_returns_correct_state_if_input_has_one_interface(
self, handler_mock, xml, interface1_mock
):
handler_mock._get_poe_interface_information = Mock(return_value=xml)
return_dict = handler_mock.get_poe_states([interface1_mock])
assert return_dict[interface1_mock.ifname] == handler_mock.POE_ENABLED

def test_returns_correct_states_if_input_has_multiple_interfaces(
self, handler_mock, xml_bulk, interface1_mock, interface2_mock
):
handler_mock._get_all_poe_interface_information = Mock(return_value=xml_bulk)
return_dict = handler_mock.get_poe_states([interface1_mock, interface2_mock])
assert return_dict[interface1_mock.ifname] == Juniper.POE_ENABLED
assert return_dict[interface2_mock.ifname] == Juniper.POE_DISABLED


class TestGetSinglePoeState:
def test_returns_correct_state_for_interface_that_exists_in_xml_response(
Expand Down

0 comments on commit d51b62e

Please sign in to comment.