Next: , Previous: , Up: Testing and Developing Trip   [Contents][Index]


8.4 Testing with Curl

The application can be tested outside a browser by using the curl command line utility.

  1. Login and get a valid session ID, using curl:
    $ curl -i -X POST -d email='user@trip.test' \
    -d password='rasHuthlutcew7' \
    http://localhost:8080/trip/app/login | grep SESSION_ID
    
  2. Fetching a single page with curl using the session ID obtained from the previous command:
    $ curl -H \
    'Cookie: TRIP_SESSION_ID=b3571314-d5c4-4690-8164-8384fd748faa' \
    'http://localhost:8080/trip/app/tracks'
    
  3. Submitting a file for file upload:
    $ curl -i -H 'Content-Type: multipart/form-data' \
    -H 'Cookie: TRIP_SESSION_ID=b3571314-d5c4-4690-8164-8384fd748faa' \
    'localhost:8080/trip/app/itinerary/upload' \
    --form 'file=@/path/to/file.gpx' -F 'id=2450' -F 'action=upload'