Smoke tests for the Mapbox CLI snap
(based on https://github.com/mapbox/mapbox-cli-py#setup)

First, build and install the snap:

    $ sudo apt install git snapcraft
    $ git clone https://github.com/elopio/mapbox-cli-py
    $ cd mapbox-cli-py
    $ git checkout snapcraft
    $ snapcraft
    $ sudo snap install *.snap --force-dangerous
    
Print the help:
   
    $ mapbox
    $ mapbox --help
    Usage: mapbox [OPTIONS] COMMAND [ARGS]...

      This is the command line interface to Mapbox web services.
    [...]
  
Print the version:

    $ mapbox --version
    0.4.0

The following steps require a Mapbox account and an API token. You can get one for free at https://www.mapbox.com/studio/account/tokens/

Setup the token:

    $ export MAPBOX_ACCESS_TOKEN=$TOKEN

Get directions:

    $ mapbox directions "[-122.681032, 45.528334]" "[-122.71679, 45.525135]"
    {"origin":{"type":"Feature","geometry":{"type":"Point","coordinates":[-122.681041,45.528333]},"properties":{"name":""}},[...]}

Get distance:

    $ mapbox distance "[-122.681, 45.528]" "[-122.716, 45.525]"
    Error: {"message":"This API currently is in preview. Please contact us at https://mapbox.com/contact/ to get access.","code":"Forbidden"}

Get geocoding:

    $ mapbox geocoding '1600 pennsylvania ave nw'
    {"type":"FeatureCollection","query":["1600","pennsylvania","ave","nw"],[...]}

Get mapmatching:

    $ wget http://people.ubuntu.com/~elopio/testfiles/2251126.geojson
    $ mapbox mapmatching 2251126.geojson 
    {"code":"Ok","type":"FeatureCollection","features":[...]}
    
Get staticmap:

    $ mapbox staticmap --lon -61.7 --lat 12.1 --zoom 12 mapbox.satelliteout out.png
    $ eog out.png

Get surface:
    
    $ mapbox surface mapbox.mapbox-terrain-v1 contour ele "[-122.781, 45.528]" "[-122.716, 45.525]"
    Error: {"message":"Feature not enabled. Please read https://www.mapbox.com/blog/introducing-the-surface-api for more information."}

The following step requires a secret token with uploads:write scope.

Upload a geojson:
    
    $ mapbox upload 2251126.geojson $MAPBOX_USERNAME.data
    {"id":"[...]","name":"data","complete":false,"error":null,"created":"[...]","modified":"[...]","tileset":"$MAPBOX_USERNAME.data","owner":"$MAPBOX_USERNAME","progress":0}

List datasets:

    $ mapbox datasets list