taverntesting / tavern

A command-line tool and Python library and Pytest plugin for automated testing of RESTful APIs, with a simple, concise and flexible YAML-based syntax
https://taverntesting.github.io/
MIT License
1.03k stars 194 forks source link

Question - overwrite imported stage #687

Open Draeggon opened 3 years ago

Draeggon commented 3 years ago

I have a stage in a global file which i import

stages:
  - id: PostRoom
    name: Creating a room
    request:
      url: "{url}/room"
      json:
        title: my title
        description: my description
      method: POST
    response:
      json:
        id: !re_fullmatch "[0-9a-f]{24}"  # the regex check if id is an objectId
        title: my title
        description: my description
        users: []
      save:
        json:
          roomId: id  # saving the id for the other function

and when i use it in another file

stages:
  - type: ref
    id: PostRoom

i need to overwrite it but i haven't find any way to do that how can it be done ?

michaelboulton commented 3 years ago

I'm not sure what you mean by 'overwrite', do you mean to overwrite parts of the stage after including it?

Draeggon commented 3 years ago

@michaelboulton yes exactly for example the save part like:

save:
  json:
    anotherName: id  # saving the id for the other function