def request_handler(event, context): logger.info(f"Processing incoming event: {event}") pretty_print = True parsed_event = event_to_command(event, context) logger.debug(f"Event was parsed to: {parsed_event}") if isinstance(parsed_event, Response): return render(parsed_event, pretty_print) handler = route_request(parsed_event) response = handler.execute(parsed_event) return render(response, pretty_print)
def indexer(event, context): logger.info(f"Processing incoming event: {event}") parsed_event = event_to_command(event, context) logger.debug(f"Event was parsed to: {parsed_event}") handler = route_request(parsed_event) handler.execute(parsed_event)
def test_invalid_endpoint(mocker): cmd = "something-else" handler = app.route_request(cmd) assert isinstance(handler, InvalidEndpointHandler)
def test_assign_global_indexes(mocker): cmd = AssignGlobalIndexes([]) handler = app.route_request(cmd) assert isinstance(handler, GlobalIndexer)
def test_fetch_global_changesets(mocker): cmd = FetchGlobalChangesets(0, None) handler = app.route_request(cmd) assert isinstance(handler, FetchGlobalChangesetsHandler)
def test_fetch_events(mocker): cmd = FetchStreamEvents("1", None, None) handler = app.route_request(cmd) assert isinstance(handler, FetchEventsHandler)
def test_fetch_changesets(mocker): cmd = FetchStreamChangesets("1", None, None) handler = app.route_request(cmd) assert isinstance(handler, FetchChangesetsHandler)
def test_commit(mocker): cmd = Commit("1", 2, None, [], []) handler = app.route_request(cmd) assert isinstance(handler, CommitHandler)
def test_version(mocker): cmd = Version() handler = app.route_request(cmd) assert isinstance(handler, VersionHandler)