コード例 #1
0
 def test_verification_response_message(self):
     message = 'Some message here'
     response = VerificationResponse(message=message, verification_key='abc')
     self.assertTrue(response.is_initialized())
     self.assertEqual(response.code, 200)
     self.assertEqual(response.message, message)
     self.assertEqual(response.verification_key, 'abc')
コード例 #2
0
 def test_verification_response_message(self):
     message = 'Some message here'
     response = VerificationResponse(message=message,
                                     verification_key='abc')
     self.assertTrue(response.is_initialized())
     self.assertEqual(response.code, 200)
     self.assertEqual(response.message, message)
     self.assertEqual(response.verification_key, 'abc')
コード例 #3
0
    def verification(self, request):
        """ Immediately dispatch a Verification to a webhook """
        self._validate_authentication()

        from tbans.models.notifications.verification import VerificationNotification
        notification = VerificationNotification(request.webhook.url, request.webhook.secret)

        from tbans.models.messages.webhook_message import WebhookMessage
        message = WebhookMessage(notification, request.webhook.url, request.webhook.secret)
        logging.info('Verification - {}'.format(str(message)))

        response = message.send()
        logging.info('Verification Response - {}'.format(str(response)))
        return VerificationResponse(code=response.status_code, message=response.content, verification_key=notification.verification_key)
コード例 #4
0
    def verification(self, request):
        """ Immediately dispatch a Verification to a webhook """
        self._validate_authentication()

        from tbans.models.notifications.verification import VerificationNotification
        notification = VerificationNotification(request.webhook.url, request.webhook.secret)

        from tbans.requests.webhook_request import WebhookRequest
        webhook_request = WebhookRequest(notification, request.webhook.url, request.webhook.secret)
        logging.info('Verification - {}'.format(str(webhook_request)))

        webhook_request.send()
        logging.info('Verification Key - {}'.format(notification.verification_key))

        return VerificationResponse(code=200, verification_key=notification.verification_key)
コード例 #5
0
 def test_verification_response_code(self):
     response = VerificationResponse(code=500, verification_key='abc')
     self.assertTrue(response.is_initialized())
     self.assertEqual(response.code, 500)
     self.assertEqual(response.message, None)
     self.assertEqual(response.verification_key, 'abc')
コード例 #6
0
 def test_verification_response_empty(self):
     response = VerificationResponse()
     self.assertFalse(response.is_initialized())
コード例 #7
0
 def test_verification_response_empty(self):
     response = VerificationResponse()
     self.assertFalse(response.is_initialized())
コード例 #8
0
 def test_verification_response_code(self):
     response = VerificationResponse(code=500, verification_key='abc')
     self.assertTrue(response.is_initialized())
     self.assertEqual(response.code, 500)
     self.assertEqual(response.message, None)
     self.assertEqual(response.verification_key, 'abc')