test_name: Create Flight

stages:
  - name: Make sure we can log in
    request:
      url: "{tavern.env_vars.API_URL}/auth/login"
      method: POST
      json:
        email: info@lufthansa.com
        password: password1234
      headers:
        content-type: application/json
    response:
      status_code: 200
      json:
        user_id: 1
        access_token: !anystr
        refresh_token: !anystr
      headers:
        content-type: application/json
      save:
       json:
        access_token: access_token
  - name: Make sure we can create a flight
    request:
      url: "{tavern.env_vars.API_URL}/flights"
      method: POST
      json:
        flight_code: 'XAS231'
        origin: 'Salta'
        destination: 'Buenos Aires'
        arrival_time: "2024-04-04 05:16 AM"
        departure_time: "2024-04-04 03:11 AM"
        gate: 'C5'
        status: 'Scheduled'
      headers:
        content-type: application/json
        authorization: Bearer {access_token}
    response:
      status_code: 200
      json:
        id: !anyint
        flight_code: !anystr
        origin: !anystr
        destination: !anystr
        arrival_time: !anystr
        departure_time: !anystr
        gate: !anystr
        status: !anystr
      headers:
        content-type: application/json

---

test_name: Flights

stages:
  - name: Make sure we can get flights
    request:
      url: "{tavern.env_vars.API_URL}/flights"
      method: GET
    response:
      status_code: 200