def test_generate_webhook_checksum(self):
     message = WebhookRequest(
         MockNotification(webhook_message_data={'data': 'value'}),
         'https://www.thebluealliance.com', 'secret')
     message_json = message._json_string()
     self.assertEqual(message._generate_webhook_checksum(message_json),
                      'dbecd85ae53d221c387647085912d2107fa04cd5')
 def test_generate_webhook_checksum_hmac_unicode_nonascii(self):
     message = WebhookRequest(
         MockNotification(webhook_message_data={'data': 'value'}),
         'https://www.thebluealliance.com', '\x80secret')
     message_json = message._json_string()
     self.assertEqual(
         message._generate_webhook_hmac(message_json),
         '2e9e974847184a9f611ed082ba0e76525d1364de520968fbe188737344358d61')
 def test_generate_webhook_checksum_hmac_unicode_ascii(self):
     message = WebhookRequest(
         MockNotification(webhook_message_data={'data': 'value'}),
         'https://www.thebluealliance.com', unicode('secret'))
     message_json = message._json_string()
     self.assertEqual(
         message._generate_webhook_hmac(message_json),
         'fb2b61d55884a648b35801688754924778b3e71ea2bf8f5effb0f3ffecb5c940')
 def test_webhook_message(self):
     webhook_message_data = {'test': 'something'}
     notification = MockNotification(
         webhook_message_data=webhook_message_data)
     message = WebhookRequest(notification,
                              'https://www.thebluealliance.com', 'secret')
     self.assertEqual(
         message._json_string(),
         '{"message_data": {"test": "something"}, "message_type": "verification"}'
     )
 def test_webhook_message_no_payload(self):
     notification = MockNotification()
     message = WebhookRequest(notification,
                              'https://www.thebluealliance.com', 'secret')
     self.assertEqual(message._json_string(),
                      '{"message_type": "verification"}')