NaturalIntelligence/Stubmatic

View on GitHub
functional-tests/assets/mappings/dbset.yaml

Summary

Maintainability
Test Coverage
# It will serve response from fault.xml if emp id is not found
# In case of customer default response will be served instead from fault.xml
-  request:
      url: /stubs/(admin|staff|customer|security)/([0-9]+)
      
   data-table:
      name: "{{ url[1] }}"
      key: "{{ url[2] }}"

   response:
      body: <auth_id>{{#token}}</auth_id><auth_id>##token##</auth_id>

# It'll return any random response if above mapping is not matched and emp id is found in prohibited_user_db
-  request:
      url: /stubs/(admin|staff|customer|security)/([0-9]+)
      
   data-table:
      name: prohibited_user_db
      key: "{{ url[2] }}"

   response:
      strategy: random
      files: ['unauthorized.xml','deleted.xml','locked.xml']

-  request:
      url: /stubs/(admin|staff|customer|security)/([0-9]+)

   response:
      body: <fault>This incident will be reported</fault>

#Serve response with random authtoken
-  request:
      url: /stubs/(admin|staff|customer|security)
      
   data-table:
      name: authtokens
      strategy: random #round-robin

   response:
      body: "##token## {{#token}}"