<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 . origination_urls import ( <EOL> OriginationUrls <EOL> ) <EOL> ACCOUNT_SID = "<STR_LIT>" <EOL> AUTH = ( ACCOUNT_SID , "<STR_LIT>" ) <EOL> BASE_URI = "<STR_LIT>" <EOL> class OriginationUrlsTest ( unittest . TestCase ) : <EOL> @ patch ( '<STR_LIT>' ) <EOL> def test_get_origination_urls_lists ( self , request ) : <EOL> resp = create_mock_json ( '<STR_LIT>' ) <EOL> resp . status_code = <NUM_LIT:200> <EOL> request . return_value = resp <EOL> origination_urls = OriginationUrls ( BASE_URI , AUTH ) <EOL> result = origination_urls . 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> ] . trunk_sid , "<STR_LIT>" ) <EOL> assert_equal ( result [ <NUM_LIT:0> ] . friendly_name , "<STR_LIT:Name>" ) <EOL> assert_equal ( result [ <NUM_LIT:0> ] . sip_url , "<STR_LIT>" ) <EOL> assert_equal ( result [ <NUM_LIT:0> ] . weight , <NUM_LIT:10> ) <EOL> assert_equal ( result [ <NUM_LIT:0> ] . priority , <NUM_LIT:20> ) <EOL> assert_true ( result [ <NUM_LIT:0> ] . enabled ) <EOL> assert_equal ( result [ <NUM_LIT:0> ] . url , "<STR_LIT>" . format ( 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_origination_urls_instance ( self , request ) : <EOL> resp = create_mock_json ( '<STR_LIT>' ) <EOL> resp . status_code = <NUM_LIT:200> <EOL> request . return_value = resp <EOL> origination_urls = OriginationUrls ( BASE_URI , AUTH ) <EOL> result = origination_urls . get ( '<STR_LIT>' ) <EOL> assert_equal ( result . sid , "<STR_LIT>" ) <EOL> assert_equal ( result . account_sid , "<STR_LIT>" ) <EOL> assert_equal ( result . trunk_sid , "<STR_LIT>" ) <EOL> assert_equal ( result . friendly_name , "<STR_LIT:Name>" ) <EOL> assert_equal ( result . sip_url , "<STR_LIT>" ) <EOL> assert_equal ( result . weight , <NUM_LIT:10> ) <EOL> assert_equal ( result . priority , <NUM_LIT:20> ) <EOL> assert_true ( result . enabled ) <EOL> assert_equal ( result . url , "<STR_LIT>" . format ( 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_origination_urls_instance ( self , request ) : <EOL> resp = create_mock_json ( '<STR_LIT>' ) <EOL> resp . status_code = <NUM_LIT> <EOL> request . return_value = resp <EOL> origination_urls = OriginationUrls ( BASE_URI , AUTH ) <EOL> result = origination_urls . create ( '<STR_LIT:Name>' , '<STR_LIT>' ) <EOL> assert_equal ( result . sid , "<STR_LIT>" ) <EOL> assert_equal ( result . account_sid , "<STR_LIT>" ) <EOL> assert_equal ( result . trunk_sid , "<STR_LIT>" ) <EOL> assert_equal ( result . friendly_name , "<STR_LIT:Name>" ) <EOL> assert_equal ( result . sip_url , "<STR_LIT>" ) <EOL> assert_equal ( result . weight , <NUM_LIT:10> ) <EOL> assert_equal ( result . priority , <NUM_LIT:20> ) <EOL> assert_true ( result . enabled ) <EOL> assert_equal ( result . url , "<STR_LIT>" . format ( BASE_URI ) ) <EOL> data_dict = dict ( ) <EOL> data_dict [ '<STR_LIT>' ] = '<STR_LIT:Name>' <EOL> data_dict [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> data_dict [ '<STR_LIT>' ] = <NUM_LIT:10> <EOL> data_dict [ '<STR_LIT>' ] = <NUM_LIT:10> <EOL> data_dict [ '<STR_LIT>' ] = '<STR_LIT:true>' <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_origination_urls_instance ( self , request ) : <EOL> resp = create_mock_json ( '<STR_LIT>' ) <EOL> resp . status_code = <NUM_LIT:200> <EOL> request . return_value = resp <EOL> origination_urls = OriginationUrls ( BASE_URI , AUTH ) <EOL> result = origination_urls . update ( '<STR_LIT>' , { '<STR_LIT>' : <NUM_LIT:10> } ) <EOL> assert_equal ( result . sid , "<STR_LIT>" ) <EOL> assert_equal ( result . account_sid , "<STR_LIT>" ) <EOL> assert_equal ( result . trunk_sid , "<STR_LIT>" ) <EOL> assert_equal ( result . friendly_name , "<STR_LIT:Name>" ) <EOL> assert_equal ( result . sip_url , "<STR_LIT>" ) <EOL> assert_equal ( result . weight , <NUM_LIT:10> ) <EOL> assert_equal ( result . priority , <NUM_LIT:20> ) <EOL> assert_true ( result . enabled ) <EOL> assert_equal ( result . url , "<STR_LIT>" . format ( BASE_URI ) ) <EOL> data_dict = dict ( ) <EOL> data_dict [ '<STR_LIT>' ] = <NUM_LIT:10> <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_origination_urls_instance ( self , request ) : <EOL> resp = Mock ( ) <EOL> resp . status_code = <NUM_LIT> <EOL> request . return_value = resp <EOL> origination_urls = OriginationUrls ( BASE_URI , AUTH ) <EOL> result = origination_urls . 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>
