Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_send_event(self):
sess = pdpyras.EventsAPISession('routingkey')
parent = MagicMock()
parent.request = MagicMock()
parent.request.side_effect = [
Response(202, '{"dedup_key":"abc123"}'),
Response(202, '{"dedup_key":"abc123"}'),
Response(202, '{"dedup_key":"abc123"}')
]
with patch.object(sess, 'parent', new=parent):
ddk = sess.trigger('testing 123', 'triggered.from.pdpyras',
custom_details={"this":"that"}, severity='warning',
images=[{'url':'https://http.cat/502.jpg'}])
self.assertEqual('abc123', ddk)
self.assertEqual(
'POST',
parent.request.call_args[0][0])
self.assertEqual(