Skip to content
  • Philip Withnall's avatar
    mock-backend: Add a mock backed implementation · 1a52772e
    Philip Withnall authored and Philip Withnall's avatar Philip Withnall committed
    This is an implementation of GeocodeBackend which returns results from
    an in-memory map of parameters to result sets, for both forward and
    reverse queries. That map is set up using API exposed by the
    GeocodeMockBackend — so a unit test harness for an application or
    library which uses geocode-glib can create a GeocodeMockBackend, set up
    some expected queries in it, then test the application or library using
    the mock GeocodeBackend instance.
    
    This allows, for example, unit tests to be written which do not require
    internet access, which is useful for many build and CI machines.
    Secondly, it allows unit tests to reliably test the error paths in an
    application or library’s code, as the map of queries can include error
    values. This allows testing an application’s handling of network
    timeouts, for example, which is otherwise tricky to set up (it requires
    a network namespace and a mock server).
    
    The GeocodeMockBackend is public API. Unit tests for it will be added in
    a follow-up commit.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=774631
    1a52772e