File tree 5 files changed +34
-9
lines changed
5 files changed +34
-9
lines changed Original file line number Diff line number Diff line change 31
31
32
32
# Print the object information.
33
33
print ('\n The following information was returned as a' , str (call .__class__ ), 'object:\n ' )
34
- print (' ' .join (str (call ).splitlines (True )))
34
+ print (' id : %s' % call .data .id )
35
+ print (' status : %s' % call .data .status )
36
+ print (' source : %s' % call .data .source )
37
+ print (' destination : %s' % call .data .destination )
38
+ print (' createdAt : %s' % call .data .createdAt )
39
+ print (' updatedAt : %s' % call .data .updatedAt )
40
+ print (' endedAt : %s' % call .data .endedAt )
35
41
36
42
except messagebird .client .ErrorException as e :
37
43
print ('\n An error occurred while requesting a Message object:\n ' )
Original file line number Diff line number Diff line change 27
27
# arguments to parse as json
28
28
jsonArgs = ['callFlow' , 'webhook' ]
29
29
30
- print ()
31
30
for jsonArg in jsonArgs :
32
31
try :
33
32
args [jsonArg ] = json .loads (str (args [jsonArg ]).strip ('\' ' ))
34
33
except json .decoder .JSONDecodeError as e :
35
34
parser .print_usage ()
36
- print ('Invalid json provided for' , jsonArg , ':' , e )
37
- print ('Provided' , jsonArg , ' json:' , args [jsonArg ])
35
+ print ('Invalid json provided for %s: %s' % ( jsonArg , e ) )
36
+ print ('Provided %s json: %s' % ( jsonArg , args [jsonArg ]) )
38
37
exit (1 )
39
38
40
39
try :
47
46
48
47
# Print the object information.
49
48
print ('\n The following information was returned as a' , str (call .__class__ ), 'object:\n ' )
49
+ print (' id : %s' % call .data .id )
50
+ print (' status : %s' % call .data .status )
51
+ print (' source : %s' % call .data .source )
52
+ print (' destination : %s' % call .data .destination )
53
+ print (' webhook : %s' % call .data .webhook )
54
+ print (' createdAt : %s' % call .data .createdAt )
55
+ print (' updatedAt : %s' % call .data .updatedAt )
56
+ print (' endedAt : %s' % call .data .endedAt )
50
57
51
58
except messagebird .client .ErrorException as e :
52
59
print ('\n An error occurred while creating a call:\n ' )
Original file line number Diff line number Diff line change @@ -49,8 +49,11 @@ def webhook(self, value):
49
49
def __str__ (self ):
50
50
return "\n " .join ([
51
51
'id : %s' % self .id ,
52
+ 'status : %s' % self .status ,
53
+ 'source : %s' % self .source ,
54
+ 'destination : %s' % self .destination ,
55
+ 'webhook : %s' % self .webhook ,
52
56
'updatedAt : %s' % self .updatedAt ,
53
57
'createdAt : %s' % self .createdAt ,
54
58
'endedAt : %s' % self .endedAt ,
55
- 'webhook : %s' % self .webhook ,
56
59
])
Original file line number Diff line number Diff line change @@ -6,3 +6,9 @@ class Webhook(Base):
6
6
def __init__ (self ):
7
7
self .url = None
8
8
self .token = None
9
+
10
+ def __str__ (self ):
11
+ return "\n " .join ([
12
+ 'url : %s' % self .url ,
13
+ 'token : %s' % self .token ,
14
+ ])
Original file line number Diff line number Diff line change @@ -97,17 +97,20 @@ def test_call_create(self):
97
97
# check all api response data is outputted
98
98
expected_data = self .create_expected_call_data_based_on_api_response (api_response )
99
99
response_data = call_creation_response .data .__dict__
100
- self .assertEqual (expected_data , response_data , 'Check client response contains the api response data.' )
100
+ self .assertEqual (expected_data , response_data , 'Check client response contains the API response data.' )
101
101
102
102
# check it can be formatted as string
103
103
expected_call_string = 'id : None\n ' + \
104
104
'data.id : 21025ed1-cc1d-4554-ac05-043fa6c84e00\n ' + \
105
+ 'data.status : queued\n ' + \
106
+ 'data.source : 31644556677\n ' + \
107
+ 'data.destination : 31612345678\n ' + \
108
+ 'data.webhook : None\n ' + \
105
109
'data.updatedAt : 2017-08-30 07:35:37+00:00\n ' + \
106
110
'data.createdAt : 2017-08-30 07:35:37+00:00\n ' + \
107
- 'data.endedAt : None\n ' + \
108
- 'data.webhook : None'
111
+ 'data.endedAt : None'
109
112
self .assertEqual (expected_call_string , str (call_creation_response ), 'Check returned call can be formatted as' +
110
- 'string' )
113
+ ' string' )
111
114
112
115
@staticmethod
113
116
def create_expected_call_data_based_on_api_response (api_response ):
You can’t perform that action at this time.
0 commit comments