<s> import mock <EOL> import unittest <EOL> import uuid <EOL> from hpOneView . common import uri <EOL> from hpOneView . connection import * <EOL> from hpOneView . networking import * <EOL> class NetworkingTest ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> super ( NetworkingTest , self ) . setUp ( ) <EOL> self . host = '<STR_LIT>' <EOL> self . connection = connection ( self . host ) <EOL> self . networking = networking ( self . connection ) <EOL> @ mock . patch . object ( connection , '<STR_LIT>' ) <EOL> def test_get_lig_default_settings ( self , mock_get ) : <EOL> self . networking . get_lig_default_settings ( ) <EOL> mock_get . assert_called_once_with ( uri [ '<STR_LIT>' ] + '<STR_LIT>' ) <EOL> @ mock . patch . object ( connection , '<STR_LIT>' ) <EOL> def test_get_lig_settings ( self , mock_get ) : <EOL> id = uuid . uuid4 ( ) <EOL> self . networking . get_lig_settings ( id ) <EOL> lig_uri = uri [ '<STR_LIT>' ] + '<STR_LIT>' <EOL> mock_get . assert_called_once_with ( lig_uri . format ( id = id ) ) <EOL> @ mock . patch . object ( connection , '<STR_LIT>' ) <EOL> def test_get_lig_by_id ( self , mock_get ) : <EOL> id = str ( uuid . uuid4 ( ) ) <EOL> self . networking . get_lig_by_id ( id ) <EOL> mock_get . assert_called_once_with ( uri [ '<STR_LIT>' ] + '<STR_LIT:/>' + id ) <EOL> @ mock . patch . object ( connection , '<STR_LIT>' ) <EOL> def test_get_lig_schema ( self , mock_get ) : <EOL> self . networking . get_lig_schema ( ) <EOL> mock_get . assert_called_once_with ( uri [ '<STR_LIT>' ] + '<STR_LIT>' ) <EOL> @ mock . patch . object ( connection , '<STR_LIT>' ) <EOL> def test_get_logical_downlinks ( self , mock_get ) : <EOL> self . networking . get_logical_downlinks ( ) <EOL> mock_get . assert_called_once_with ( uri [ '<STR_LIT>' ] ) <EOL> mock_get . reset_mock ( ) <EOL> filter = '<STR_LIT>' <EOL> self . networking . get_logical_downlinks ( filter = filter ) <EOL> mock_get . assert_called_once_with ( uri [ '<STR_LIT>' ] + filter ) <EOL> @ mock . patch . object ( connection , '<STR_LIT>' ) <EOL> def test_get_logical_downlinks_schema ( self , mock_get ) : <EOL> self . networking . get_logical_downlinks_schema ( ) <EOL> mock_get . assert_called_once_with ( uri [ '<STR_LIT>' ] + '<STR_LIT>' ) <EOL> @ mock . patch . object ( connection , '<STR_LIT>' ) <EOL> def test_get_logical_downlinks_without_ethernet ( self , mock_get ) : <EOL> self . networking . get_logical_downlinks_without_ethernet ( ) <EOL> downlinks_uri = uri [ '<STR_LIT>' ] + '<STR_LIT>' <EOL> mock_get . assert_called_once_with ( downlinks_uri ) <EOL> mock_get . reset_mock ( ) <EOL> filter = '<STR_LIT>' <EOL> self . networking . get_logical_downlinks_without_ethernet ( filter = filter ) <EOL> mock_get . assert_called_once_with ( downlinks_uri + filter ) <EOL> @ mock . patch . object ( connection , '<STR_LIT>' ) <EOL> def test_get_logical_downlink_by_id ( self , mock_get ) : <EOL> id = str ( uuid . uuid4 ( ) ) <EOL> self . networking . get_logical_downlink ( id ) <EOL> mock_get . assert_called_once_with ( uri [ '<STR_LIT>' ] + '<STR_LIT:/>' + id ) <EOL> @ mock . patch . object ( connection , '<STR_LIT>' ) <EOL> def test_get_logical_downlink_without_ethernet_by_id ( self , mock_get ) : <EOL> id = str ( uuid . uuid4 ( ) ) <EOL> self . networking . get_logical_downlink_without_ethernet ( id ) <EOL> downlink_uri = uri [ '<STR_LIT>' ] + '<STR_LIT>' <EOL> mock_get . assert_called_once_with ( downlink_uri . format ( id = id ) ) <EOL> @ mock . patch . object ( connection , '<STR_LIT>' ) <EOL> def test_get_logical_interconnects ( self , mock_get ) : <EOL> self . networking . get_lis ( ) <EOL> mock_get . assert_called_once_with ( uri [ '<STR_LIT>' ] ) <EOL> mock_get . reset_mock ( ) <EOL> filter = '<STR_LIT>' <EOL> self . networking . get_lis ( filter = filter ) <EOL> mock_get . assert_called_once_with ( uri [ '<STR_LIT>' ] + filter ) <EOL> @ mock . patch . object ( connection , '<STR_LIT>' ) <EOL> def test_correct_lis ( self , mock_put ) : <EOL> uris = [ uuid . uuid4 ( ) . hex , uuid . uuid4 ( ) . hex , uuid . uuid4 ( ) . hex ] <EOL> mock_put . return_value = ( None , None ) <EOL> request = { '<STR_LIT>' : uris } <EOL> self . networking . correct_lis ( uris , blocking = False ) <EOL> mock_put . assert_called_once_with ( uri [ '<STR_LIT>' ] + '<STR_LIT>' , request ) <EOL> @ mock . patch . object ( connection , '<STR_LIT>' ) <EOL> def test_create_li ( self , mock_post ) : <EOL> location_entries = [ uuid . uuid4 ( ) . hex , uuid . uuid4 ( ) . hex ] <EOL> mock_post . return_value = ( None , None ) <EOL> request = { '<STR_LIT>' : location_entries } <EOL> self . networking . create_li ( location_entries , blocking = False ) <EOL> mock_post . assert_called_once_with ( <EOL> uri [ '<STR_LIT>' ] + '<STR_LIT>' , request ) <EOL> @ mock . patch . object ( connection , '<STR_LIT>' ) <EOL> def test_delete_li ( self , mock_delete ) : <EOL> location = self . host <EOL> mock_delete . return_value = ( None , None ) <EOL> self . networking . delete_li ( location , blocking = False ) <EOL> mock_delete . assert_called_once_with ( <EOL> uri [ '<STR_LIT>' ] + '<STR_LIT>' + location ) <EOL> @ mock . patch . object ( connection , '<STR_LIT>' ) <EOL> def test_get_logical_interconnects_schema ( self , mock_get ) : <EOL> self . networking . get_li_schema ( ) <EOL> mock_get . assert_called_once_with ( uri [ '<STR_LIT>' ] + '<STR_LIT>' ) <EOL> @ mock . patch . object ( connection , '<STR_LIT>' ) <EOL> def test_get_logical_interconnects_by_id ( self , mock_get ) : <EOL> id = uuid . uuid4 ( ) . hex <EOL> self . networking . get_li_by_id ( id ) <EOL> mock_get . assert_called_once_with ( uri [ '<STR_LIT>' ] + '<STR_LIT:/>' + id ) <EOL> @ mock . patch . object ( connection , '<STR_LIT>' ) <EOL> def test_correct_li_by_id ( self , mock_put ) : <EOL> id = uuid . uuid4 ( ) . hex <EOL> mock_put . return_value = ( None , None ) <EOL> self . networking . correct_li_by_id ( id , blocking = False ) <EOL> correct_li_uri = uri [ '<STR_LIT>' ] + '<STR_LIT>' <EOL> mock_put . assert_called_once_with ( correct_li_uri . format ( id = id ) , { } ) <EOL> @ mock . patch . object ( connection , '<STR_LIT>' ) <EOL> def test_update_ethernet_interconnected_settings ( self , mock_put ) : <EOL> id = uuid . uuid4 ( ) . hex <EOL> mock_put . return_value = ( None , None ) <EOL> settings_test = { "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : <NUM_LIT:200> , <EOL> "<STR_LIT>" : <NUM_LIT:10> , <EOL> "<STR_LIT:name>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : '<STR_LIT:false>' , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : True , <EOL> "<STR_LIT>" : True , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : True , <EOL> "<STR_LIT>" : True , <EOL> "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT:type>" : "<STR_LIT>" , <EOL> "<STR_LIT:id>" : "<STR_LIT>" } <EOL> self . networking . update_ethernet_interconnected_settings ( <EOL> id , settings_test , blocking = False ) <EOL> correct_li_uri = uri [ '<STR_LIT>' ] + '<STR_LIT>' <EOL> mock_put . assert_called_once_with ( correct_li_uri . format ( id = id ) , <EOL> settings_test ) <EOL> @ mock . patch . object ( connection , '<STR_LIT>' ) <EOL> def test_get_logical_interconnect_firmware ( self , mock_get ) : <EOL> id = uuid . uuid4 ( ) . hex <EOL> self . networking . get_li_firmware ( id ) <EOL> li_firmware_uri = uri [ '<STR_LIT>' ] + '<STR_LIT>' <EOL> mock_get . assert_called_once_with ( li_firmware_uri . format ( id = id ) ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> unittest . main ( ) </s>
