- category: example
  name: exampleValidationBodyEmpty
  target: example
  input:
    method: POST
    path: /examples
    headers:
      Content-Type: application/json
    body: |-
      def randomBody():
          return dict()
  assertion:
    output: |-
      async def assertion():
          assert Response.code==400, "Invalid validation schema %r" % Response.code
- category: example
  name: exampleValidationHeaderEmpty
  target: example
  input:
    method: POST
    path: /examples
    headers: {}
    body: |-
      def randomBody():
          import rstr
          return dict(name=rstr.xeger("^[A-Z][a-zA-Z_0-9-]+$"), region=rstr.rstr(["jp1", "jp2"], 1))
  assertion:
    output: |-
      async def assertion():
          assert Response.code==400, "Invalid validation schema %r" % Response.code
- category: example
  name: exampleValidationHeaderContentType
  target: example
  input:
    method: POST
    path: /examples
    headers:
      Content-Type: application/xml
    body: |-
      def randomBody():
          import rstr
          return dict(name=rstr.xeger("^[A-Z][a-zA-Z_0-9-]+$"), region=rstr.rstr(["jp1", "jp2"], 1))
  assertion:
    output: |-
      async def assertion():
          assert Response.code==400, "Invalid validation schema %r" % Response.code
- category: example
  name: exampleValidationBodyNameRequired
  target: example
  input:
    method: POST
    path: /examples
    headers:
      Content-Type: application/json
    body: |-
      def randomBody():
          import rstr
          return dict(region=rstr.rstr(["jp1", "jp2"], 1))
  assertion:
    output: |-
      async def assertion():
          assert Response.code==400, "Invalid validation schema %r" % Response.code
- category: example
  name: exampleValidationBodyRegionRequired
  target: example
  input:
    method: POST
    path: /examples
    headers:
      Content-Type: application/json
    body: |-
      def randomBody():
          import rstr
          return dict(name=rstr.word())
  assertion:
    output: |-
      async def assertion():
          assert Response.code==400, "Invalid validation schema %r" % Response.code
- category: example
  name: exampleNormalDryrun
  target: example
  illusion: exampleDryrun
  input:
    method: POST
    path: /examples
    headers:
      Content-Type: application/json
    body: |-
      def randomBody():
          import rstr
          return dict(name=rstr.xeger("^[A-Z][a-zA-Z_0-9-]+$"), region=rstr.rstr(["jp1", "jp2"], 1))
  assertion:
    output: |-
      async def assertion():
          assert Response.code==202, "Invalid response code %r" % Response.code
          assert Response.body, "Empty body %r" % Response.body
          assert "hogeID" in json.loads(Response.body), "Invalid response body %s" % Response.body
    progress:
    - index: 1
      script: |-
        async def assertion():
            assert Transaction.xglobals.name and Transaction.xglobals.region, "name or region is None"
            assert Transaction.xglobals.hogeID is not None, "hogeID is None"
    end: |-
      async def assertion():
          assert Transaction.status=="Complete", "Transaction is in an unexpected state %r" % Transaction.status
- category: example
  name: examplePostFailed
  target: example
  illusion: examplePostFailed
  input:
    method: POST
    path: /examples
    headers:
      Content-Type: application/json
    body: |-
      def randomBody():
          import rstr
          return dict(name=rstr.xeger("^[A-Z][a-zA-Z_0-9-]+$"), region=rstr.rstr(["jp1", "jp2"], 1))
  assertion:
    output: |-
      async def assertion():
          assert Response.code==500, "Invalid response code %r" % Response.code
- category: example
  name: exampleSubnormalWaitforActiveFailed
  target: example
  illusion: exampleWaitforActiveFailed
  input:
    method: POST
    path: /examples
    headers:
      Content-Type: application/json
    body: |-
      def randomBody():
          import rstr
          return dict(name=rstr.xeger("^[A-Z][a-zA-Z_0-9-]+$"), region=rstr.rstr(["jp1", "jp2"], 1))
  assertion:
    output: |-
      async def assertion():
          assert Response.code==202, "Invalid response code %r" % Response.code
          assert Response.body, "Empty body %r" % Response.body
          assert "hogeID" in json.loads(Response.body), "Invalid response body %s" % Response.body
    progress:
    - index: 1
      script: |-
        async def assertion():
            assert Transaction.xglobals.name and Transaction.xglobals.region, "name or region is None"
            assert Transaction.xglobals.hogeID is not None, "hogeID is None"
    end: |-
      async def assertion():
          assert Transaction.status=="Cancelled", "Transaction is in an unexpected state %r" % Transaction.status
- category: example
  name: exampleSubnormalDryrun
  target: example
  illusion: exampleDetectedErrorHogeState
  input:
    method: POST
    path: /examples
    headers:
      Content-Type: application/json
    body: |-
      def randomBody():
          import rstr
          return dict(name=rstr.xeger("^[A-Z][a-zA-Z_0-9-]+$"), region=rstr.rstr(["jp1", "jp2"], 1))
  assertion:
    output: |-
      async def assertion():
          assert Response.code==202, "Invalid response code %r" % Response.code
          assert Response.body, "Empty body %r" % Response.body
          assert "hogeID" in json.loads(Response.body), "Invalid response body %s" % Response.body
    progress:
    - index: 1
      script: |-
        async def assertion():
            assert Transaction.xglobals.name and Transaction.xglobals.region, "name or region is None"
            assert Transaction.xglobals.hogeID is not None, "hogeID is None"
    end: |-
      async def assertion():
          assert Transaction.status=="Cancelled", "Transaction is in an unexpected state %r" % Transaction.status
- category: example
  name: exampleAbnormalGetFailed
  target: example
  illusion: exampleGetFailed
  input:
    method: POST
    path: /examples
    headers:
      Content-Type: application/json
    body: |-
      def randomBody():
          import rstr
          return dict(name=rstr.xeger("^[A-Z][a-zA-Z_0-9-]+$"), region=rstr.rstr(["jp1", "jp2"], 1))
  assertion:
    output: |-
      async def assertion():
          assert Response.code==202, "Invalid response code %r" % Response.code
          assert Response.body, "Empty body %r" % Response.body
          assert "hogeID" in json.loads(Response.body), "Invalid response body %s" % Response.body
    progress:
    - index: 1
      script: |-
        async def assertion():
            assert Transaction.xglobals.name and Transaction.xglobals.region, "name or region is None"
            assert Transaction.xglobals.hogeID is not None, "hogeID is None"
    end: |-
      async def assertion():
          assert Transaction.status=="Aborted", "Transaction is in an unexpected state %r" % Transaction.status
  cleanup: |-
    async def cleanup():
        await Transaction.cancel(force=True)
        assert Transaction.status=="ForceCancelled", "Force cancel failed %r" % Transaction.status
- category: example
  name: exampleAbnormalDeleteFailed
  target: example
  illusion: exampleDeleteFailed
  input:
    method: POST
    path: /examples
    headers:
      Content-Type: application/json
    body: |-
      def randomBody():
          import rstr
          return dict(name=rstr.xeger("^[A-Z][a-zA-Z_0-9-]+$"), region=rstr.rstr(["jp1", "jp2"], 1))
  assertion:
    output: |-
      async def assertion():
          assert Response.code==202, "Invalid response code %r" % Response.code
          assert Response.body, "Empty body %r" % Response.body
          assert "hogeID" in json.loads(Response.body), "Invalid response body %s" % Response.body
    progress:
    - index: 1
      script: |-
        async def assertion():
            assert Transaction.xglobals.name and Transaction.xglobals.region, "name or region is None"
            assert Transaction.xglobals.hogeID is not None, "hogeID is None"
    end: |-
      async def assertion():
          assert Transaction.status=="Aborted", "Transaction is in an unexpected state %r" % Transaction.status
  cleanup: |-
    async def cleanup():
        await Transaction.cancel(force=True)
        assert Transaction.status=="ForceCancelled", "Force cancel failed %r" % Transaction.status
- category: example
  name: exampleAbnormalWaitforNotFoundFailed
  target: example
  illusion: exampleWaitforNotFoundFailed
  input:
    method: POST
    path: /examples
    headers:
      Content-Type: application/json
    body: |-
      def randomBody():
          import rstr
          return dict(name=rstr.xeger("^[A-Z][a-zA-Z_0-9-]+$"), region=rstr.rstr(["jp1", "jp2"], 1))
  assertion:
    output: |-
      async def assertion():
          assert Response.code==202, "Invalid response code %r" % Response.code
          assert Response.body, "Empty body %r" % Response.body
          assert "hogeID" in json.loads(Response.body), "Invalid response body %s" % Response.body
    progress:
    - index: 1
      script: |-
        async def assertion():
            assert Transaction.xglobals.name and Transaction.xglobals.region, "name or region is None"
            assert Transaction.xglobals.hogeID is not None, "hogeID is None"
    end: |-
      async def assertion():
          assert Transaction.status=="Aborted", "Transaction is in an unexpected state %r" % Transaction.status
  cleanup: |-
    async def cleanup():
        await Transaction.cancel(force=True)
        assert Transaction.status=="ForceCancelled", "Force cancel failed %r" % Transaction.status
