<s> import unittest <EOL> from mock import Mock , patch <EOL> from nose . tools import assert_equal , assert_true <EOL> from tests . tools import create_mock_json <EOL> from twilio . rest . resources . trunking . trunks import ( <EOL> Trunks <EOL> ) <EOL> ACCOUNT_SID = "<STR_LIT>" <EOL> AUTH = ( ACCOUNT_SID , "<STR_LIT>" ) <EOL> BASE_URI = "<STR_LIT>" <EOL> TRUNK_SID = "<STR_LIT>" <EOL> class TrunksTest ( unittest . TestCase ) : <EOL> @ patch ( '<STR_LIT>' ) <EOL> def test_get_trunks_lists ( self , request ) : <EOL> resp = create_mock_json ( '<STR_LIT>' ) <EOL> resp . status_code = <NUM_LIT:200> <EOL> request . return_value = resp <EOL> trunks = Trunks ( BASE_URI , AUTH ) <EOL> result = trunks . list ( ) <EOL> assert_equal ( len ( result ) , <NUM_LIT:1> ) <EOL> assert_equal ( result [ <NUM_LIT:0> ] . sid , '<STR_LIT>' ) <EOL> assert_equal ( result [ <NUM_LIT:0> ] . account_sid , '<STR_LIT>' ) <EOL> assert_equal ( result [ <NUM_LIT:0> ] . domain_name , "<STR_LIT>" ) <EOL> assert_equal ( result [ <NUM_LIT:0> ] . friendly_name , "<STR_LIT>" ) <EOL> assert_equal ( result [ <NUM_LIT:0> ] . recording , <EOL> { "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" } ) <EOL> assert_equal ( result [ <NUM_LIT:0> ] . auth_type , "<STR_LIT>" ) <EOL> assert_equal ( result [ <NUM_LIT:0> ] . auth_type_set , [ "<STR_LIT>" ] ) <EOL> TRUNK_INSTANCE_BASE_URI = "<STR_LIT>" . format ( BASE_URI , "<STR_LIT>" , <EOL> TRUNK_SID ) <EOL> assert_equal ( result [ <NUM_LIT:0> ] . url , TRUNK_INSTANCE_BASE_URI ) <EOL> assert_equal ( result [ <NUM_LIT:0> ] . links [ '<STR_LIT>' ] , <EOL> "<STR_LIT>" . format ( TRUNK_INSTANCE_BASE_URI ) ) <EOL> assert_equal ( result [ <NUM_LIT:0> ] . links [ '<STR_LIT>' ] , <EOL> "<STR_LIT>" . format ( TRUNK_INSTANCE_BASE_URI ) ) <EOL> assert_equal ( result [ <NUM_LIT:0> ] . links [ '<STR_LIT>' ] , <EOL> "<STR_LIT>" . format ( TRUNK_INSTANCE_BASE_URI ) ) <EOL> assert_equal ( result [ <NUM_LIT:0> ] . links [ '<STR_LIT>' ] , <EOL> "<STR_LIT>" . format ( TRUNK_INSTANCE_BASE_URI ) ) <EOL> request . assert_called_with ( <EOL> "<STR_LIT:GET>" , <EOL> "<STR_LIT>" . format ( BASE_URI ) , <EOL> auth = AUTH , <EOL> params = { } , <EOL> use_json_extension = False , <EOL> ) <EOL> @ patch ( '<STR_LIT>' ) <EOL> def test_get_trunks_instance ( self , request ) : <EOL> resp = create_mock_json ( '<STR_LIT>' ) <EOL> resp . status_code = <NUM_LIT:200> <EOL> request . return_value = resp <EOL> trunks = Trunks ( BASE_URI , AUTH ) <EOL> result = trunks . get ( '<STR_LIT>' ) <EOL> assert_equal ( result . sid , '<STR_LIT>' ) <EOL> assert_equal ( result . account_sid , '<STR_LIT>' ) <EOL> assert_equal ( result . domain_name , "<STR_LIT>" ) <EOL> assert_equal ( result . friendly_name , "<STR_LIT>" ) <EOL> assert_equal ( result . recording , <EOL> { "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" } ) <EOL> assert_equal ( result . auth_type , "<STR_LIT>" ) <EOL> assert_equal ( result . auth_type_set , [ "<STR_LIT>" ] ) <EOL> TRUNK_INSTANCE_BASE_URI = "<STR_LIT>" . format ( BASE_URI , "<STR_LIT>" , <EOL> TRUNK_SID ) <EOL> assert_equal ( result . url , TRUNK_INSTANCE_BASE_URI ) <EOL> assert_equal ( result . links [ '<STR_LIT>' ] , <EOL> "<STR_LIT>" . format ( TRUNK_INSTANCE_BASE_URI ) ) <EOL> assert_equal ( result . links [ '<STR_LIT>' ] , <EOL> "<STR_LIT>" . format ( TRUNK_INSTANCE_BASE_URI ) ) <EOL> assert_equal ( result . links [ '<STR_LIT>' ] , <EOL> "<STR_LIT>" . format ( TRUNK_INSTANCE_BASE_URI ) ) <EOL> assert_equal ( result . links [ '<STR_LIT>' ] , <EOL> "<STR_LIT>" . format ( TRUNK_INSTANCE_BASE_URI ) ) <EOL> request . assert_called_with ( <EOL> "<STR_LIT:GET>" , <EOL> "<STR_LIT>" . format ( BASE_URI ) , <EOL> auth = AUTH , <EOL> use_json_extension = False <EOL> ) <EOL> @ patch ( '<STR_LIT>' ) <EOL> def test_create_trunk_instance ( self , request ) : <EOL> resp = create_mock_json ( '<STR_LIT>' ) <EOL> resp . status_code = <NUM_LIT> <EOL> request . return_value = resp <EOL> trunks = Trunks ( BASE_URI , AUTH ) <EOL> kwargs = { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' <EOL> } <EOL> result = trunks . create ( ** kwargs ) <EOL> assert_equal ( result . sid , '<STR_LIT>' ) <EOL> assert_equal ( result . account_sid , '<STR_LIT>' ) <EOL> assert_equal ( result . domain_name , "<STR_LIT>" ) <EOL> assert_equal ( result . friendly_name , "<STR_LIT>" ) <EOL> assert_equal ( result . recording , <EOL> { "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" } ) <EOL> assert_equal ( result . auth_type , "<STR_LIT>" ) <EOL> assert_equal ( result . auth_type_set , [ "<STR_LIT>" ] ) <EOL> TRUNK_INSTANCE_BASE_URI = "<STR_LIT>" . format ( BASE_URI , "<STR_LIT>" , <EOL> TRUNK_SID ) <EOL> assert_equal ( result . url , TRUNK_INSTANCE_BASE_URI ) <EOL> assert_equal ( result . links [ '<STR_LIT>' ] , <EOL> "<STR_LIT>" . format ( TRUNK_INSTANCE_BASE_URI ) ) <EOL> assert_equal ( result . links [ '<STR_LIT>' ] , <EOL> "<STR_LIT>" . format ( TRUNK_INSTANCE_BASE_URI ) ) <EOL> assert_equal ( result . links [ '<STR_LIT>' ] , <EOL> "<STR_LIT>" . format ( TRUNK_INSTANCE_BASE_URI ) ) <EOL> assert_equal ( result . links [ '<STR_LIT>' ] , <EOL> "<STR_LIT>" . format ( TRUNK_INSTANCE_BASE_URI ) ) <EOL> data_dict = dict ( ) <EOL> data_dict [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> data_dict [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> request . assert_called_with ( <EOL> "<STR_LIT:POST>" , <EOL> "<STR_LIT>" . format ( BASE_URI ) , <EOL> auth = AUTH , <EOL> use_json_extension = False , <EOL> data = data_dict , <EOL> ) <EOL> @ patch ( '<STR_LIT>' ) <EOL> def test_update_trunk_instance ( self , request ) : <EOL> resp = create_mock_json ( '<STR_LIT>' ) <EOL> resp . status_code = <NUM_LIT:200> <EOL> request . return_value = resp <EOL> trunks = Trunks ( BASE_URI , AUTH ) <EOL> result = trunks . update ( '<STR_LIT>' , { '<STR_LIT>' : '<STR_LIT>' } ) <EOL> assert_equal ( result . sid , '<STR_LIT>' ) <EOL> assert_equal ( result . account_sid , '<STR_LIT>' ) <EOL> assert_equal ( result . domain_name , "<STR_LIT>" ) <EOL> assert_equal ( result . friendly_name , "<STR_LIT>" ) <EOL> assert_equal ( result . recording , <EOL> { "<STR_LIT>" : "<STR_LIT>" , <EOL> "<STR_LIT>" : "<STR_LIT>" } ) <EOL> assert_equal ( result . auth_type , "<STR_LIT>" ) <EOL> assert_equal ( result . auth_type_set , [ "<STR_LIT>" ] ) <EOL> TRUNK_INSTANCE_BASE_URI = "<STR_LIT>" . format ( BASE_URI , "<STR_LIT>" , <EOL> TRUNK_SID ) <EOL> assert_equal ( result . url , TRUNK_INSTANCE_BASE_URI ) <EOL> assert_equal ( result . links [ '<STR_LIT>' ] , <EOL> "<STR_LIT>" . format ( TRUNK_INSTANCE_BASE_URI ) ) <EOL> assert_equal ( result . links [ '<STR_LIT>' ] , <EOL> "<STR_LIT>" . format ( TRUNK_INSTANCE_BASE_URI ) ) <EOL> assert_equal ( result . links [ '<STR_LIT>' ] , <EOL> "<STR_LIT>" . format ( TRUNK_INSTANCE_BASE_URI ) ) <EOL> assert_equal ( result . links [ '<STR_LIT>' ] , <EOL> "<STR_LIT>" . format ( TRUNK_INSTANCE_BASE_URI ) ) <EOL> data_dict = dict ( ) <EOL> data_dict [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> request . assert_called_with ( <EOL> "<STR_LIT:POST>" , <EOL> "<STR_LIT>" . format ( BASE_URI ) , <EOL> auth = AUTH , <EOL> use_json_extension = False , <EOL> data = data_dict <EOL> ) <EOL> @ patch ( '<STR_LIT>' ) <EOL> def test_delete_trunk_instance ( self , request ) : <EOL> resp = Mock ( ) <EOL> resp . status_code = <NUM_LIT> <EOL> request . return_value = resp <EOL> trunks = Trunks ( BASE_URI , AUTH ) <EOL> result = trunks . delete ( '<STR_LIT>' ) <EOL> assert_true ( result ) <EOL> request . assert_called_with ( <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" . format ( BASE_URI ) , <EOL> auth = AUTH , <EOL> use_json_extension = False <EOL> ) </s>
