예제 #1
0
def test_send_event():
    # Valid event
    event = {
        'event_name':  'user_created',
        'properties': {
            'user_id': 123,
            'gender': 'Male',
            'platform': 'iOS'
        }
    }
    ret = event_api.send(event)
    assert len(ret['invalid_events']) == 0
    gevent.sleep(2.0)
예제 #2
0
def test_invalid_event():
    # Event with invalid event name
    events = [
        # invalid event name
        {
            'event_name':  'invalid event name',
        },
        # invalid event property `gender`
        {
            'event_name':  'user_created',
            'properties': {
                'user_id': 123,
                'gender': 'Animal',
                'platform': 'iOS'
            }
        }
    ]
    ret = event_api.send(events)
    assert len(ret['invalid_events']) == 2