def test_publish_error(self): dapr = DaprClient(f'localhost:{self.server_port}') with self.assertRaisesRegex(ValueError, "invalid type for data <class 'int'>"): dapr.publish_event( pubsub_name='pubsub', topic='example', data=111, )
def test_publish_event(self): dapr = DaprClient(f'localhost:{self.server_port}') resp = dapr.publish_event( pubsub_name='pubsub', topic='example', data=b'haha', ) self.assertEqual(2, len(resp.headers)) self.assertEqual(['haha'], resp.headers['hdata'])