def test(self):
     session = boto3.Session(profile_name='dev')
     sns = session.client('sns')
     listener_arn = 'arn:aws:sns:us-east-1:726075243133:leech-dev-Listener-1EV4D8VOW7L37'
     bull_horn = Bullhorn(sns)
     schema = Schema.retrieve()
     schema_entry = schema['ExternalId']
     message = ajson.dumps({
         'task_name': 'generate_source_vertex',
         'task_args': None,
         'task_kwargs': {
             'schema': schema,
             'schema_entry': schema_entry,
             'extracted_data': {
                 'source': {
                     'id_source': 'Algernon',
                     'id_type': 'Employees',
                     'id_name': 'emp_id',
                     'id_value': 1001
                 }
             }
         }
     })
     message_id = bull_horn.publish('new_event', listener_arn, message)
     assert message_id
Exemplo n.º 2
0
 def test_bullhorn_batch_send(self):
     with patch('botocore.client.BaseClient._make_api_call') as mock:
         bullhorn = Bullhorn({'test': 'test_arn'})
         with bullhorn as batch:
             for _ in range(100):
                 batch.publish('test', 'some_arn', f'hello world, {_}')
         assert mock.called
         assert mock.call_count == 100