示例#1
0
    def test_event_publisher_success(self, mock_push_event,
                                     mock_read_registry_event):
        mock_read_registry_event.return_value = [{
            'row_id':
            526,
            'block_no':
            6247992,
            'event':
            'ServiceCreated',
            'json_str':
            "{'orgId': b'snet\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00', 'serviceId': b'freecall\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00', 'metadataURI': b'ipfs://QmQtm73kmKhv6mKTkn7qW3uMPtgK6c5Qytb11sCxY98s5j\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00'}",
            'processed':
            0,
            'transactionHash':
            "b'~\\xb5\\x0c\\x93\\xe7y\\xc1\\x9d\\xf2I\\xef3\\xc6H\\x16\\xbd\\xab \\xa4\\xb5\\r\\xaau5eb\\x82B\\xe0\\x1c\\xf7\\xdd'",
            'logIndex':
            '43',
            'error_code':
            200,
            'error_msg':
            '',
            'row_updated':
            '2019-10-31 09:44:00',
            'row_created':
            '2019-10-31 09:44:00'
        }]
        mock_push_event.return_value = {"statusCode": 200}

        error_map, success_list = RegistryEventListener(
        ).listen_and_publish_registry_events()
        assert success_list == [526]
def registry_event_listener_handler(event, context):
    RegistryEventListener().listen_and_publish_registry_events()