Beispiel #1
0
 def test_getmsgcharge_fail(self):
     clickatell = Clickatell('username', 'password', 'api_id',
                                 client_class=TestClient)
     clickatell.session_id = "session_id"
     clickatell.client.mock('GET', getmsgcharge_url, {
         'session_id': clickatell.session_id,
         'apimsgid': 'apimsgid'
     }, response=clickatell.client.parse_content(
         'ERR: 108, Invalid or missing API ID'
     ))
     
     resp = clickatell.getmsgcharge(apimsgid='apimsgid')
     self.assertTrue(isinstance(resp, ERRResponse))
     self.assertEquals(resp.code, 108)
     self.assertEquals(resp.reason, 'Invalid or missing API ID')
Beispiel #2
0
 def test_getmsgcharge(self):
     clickatell = Clickatell('username', 'password', 'api_id',
                                 client_class=TestClient)
     clickatell.session_id = "session_id"
     clickatell.client.mock('GET', getmsgcharge_url, {
         'session_id': clickatell.session_id,
         'apimsgid': 'apimsgid'
     }, response=clickatell.client.parse_content(
         'apiMsgId: apimsgid charge: 1 status: 002'
     ))
     
     resp = clickatell.getmsgcharge(apimsgid='apimsgid')
     self.assertTrue(isinstance(resp, ApiMsgIdResponse))
     self.assertEquals(resp.value, 'apimsgid')
     self.assertEquals(resp.extra, {'charge': '1', 'status': '002'})