def test_delete_event():
    event = helpers.create_test_event()
    fetched_event = event_manager.get_event(event.id)
    assert fetched_event is not None
    event_manager.delete_event(event.id)
    fetched_event = event_manager.get_event(event.id)
    assert fetched_event is None

    helpers.cleanup(event.id)
def test_create_event():
    event = helpers.create_test_event()
    fetched_event = event_manager.get_event(event.id)
    assert fetched_event is not None
    assert fetched_event.id == event.id

    helpers.cleanup(event.id)
def test_update_event_severity():
    event = helpers.create_test_event()
    assert event.event_severity is None
    event_manager.update_event_severity(event.id, 5)
    fetched_event = event_manager.get_event(event.id)
    assert fetched_event.event_severity == 5

    helpers.cleanup(event.id)
def test_update_event_duration():
    event = helpers.create_test_event()
    assert event.event_duration is None
    event_manager.update_event_duration(event.id, "1-3")
    fetched_event = event_manager.get_event(event.id)
    assert fetched_event.event_duration == "1-3"

    helpers.cleanup(event.id)
def test_update_event_type():
    event = helpers.create_test_event()
    assert event.event_type is None
    event_manager.update_event_type(event.id, AURA_EVENT_TYPE)
    fetched_event = event_manager.get_event(event.id)
    assert fetched_event.event_type == AURA_EVENT_TYPE

    helpers.cleanup(event.id)
def test_update_event_tracking_status():
    event = helpers.create_test_event()
    assert event.event_tracking_status_name == 'CREATED'

    event_manager.update_event_type(event.id, AURA_EVENT_TYPE)
    event_manager.update_event_tracking_status(event.id)
    fetched_event = event_manager.get_event(event.id)
    assert fetched_event.event_tracking_status_name == 'PARTIALLY_COMPLETE'

    event_manager.update_event_severity(event.id, 4)
    event_manager.update_event_tracking_status(event.id)
    fetched_event = event_manager.get_event(event.id)
    assert fetched_event.event_tracking_status_name == 'PARTIALLY_COMPLETE'

    event_manager.update_event_duration(event.id, 80)
    event_manager.update_event_tracking_status(event.id)
    fetched_event = event_manager.get_event(event.id)
    assert fetched_event.event_tracking_status_name == 'COMPLETE'

    helpers.cleanup(event.id)
Exemplo n.º 7
0
def update_event():
	json = request.get_json()
	print "received request " + str(json)
	event_id = json['event_id']
	event = event_manager.get_event(event_id)
	event.event_type = request.json['event_type']
	event.event_duration = request.json['event_duration']
	event_manager.update_event(event)
	event_manager.update_event_tracking_status(event_id)
	return jsonify(
		event_id=event_id
	)
Exemplo n.º 8
0
def get_event(event_id):
    event = event_manager.get_event(event_id)
    response = jsonify(
        event_id=event.id,
        user_internal_id=event.user_id,
        event_time=event.event_time,
        event_type=event.event_type,
        event_duration=event.event_duration,
        event_tracking_status=event.event_tracking_status_name
    )
    print response.data
    return response