+test_name: test the delay receiver
+
+stages:
+
+ - name: test the delay policy type not there yet
+ request:
+ url: http://localhost:10000/a1-p/policytypes/20001
+ method: GET
+ response:
+ status_code: 404
+
+ - name: not yet in type list
+ request:
+ url: http://localhost:10000/a1-p/policytypes
+ method: GET
+ response:
+ status_code: 200
+ body: []
+
+ - name: instance list 404
+ request:
+ url: http://localhost:10000/a1-p/policytypes/20001/policies
+ method: GET
+ response:
+ status_code: 404
+
+ - name: put the type
+ request:
+ url: http://localhost:10000/a1-p/policytypes/20001
+ method: PUT
+ json:
+ name: test policy
+ description: just for testing
+ policy_type_id: 20001
+ create_schema:
+ "$schema": http://json-schema.org/draft-07/schema#
+ type: object
+ properties:
+ test:
+ type: string
+ required:
+ - test
+ additionalProperties: false
+ response:
+ status_code: 201
+
+ - name: type there now
+ request:
+ url: http://localhost:10000/a1-p/policytypes/20001
+ method: GET
+ response:
+ status_code: 200
+ body:
+ name: test policy
+ description: just for testing
+ policy_type_id: 20001
+ create_schema:
+ "$schema": http://json-schema.org/draft-07/schema#
+ type: object
+ properties:
+ test:
+ type: string
+ required:
+ - test
+ additionalProperties: false
+
+ - name: now in type list
+ request:
+ url: http://localhost:10000/a1-p/policytypes
+ method: GET
+ response:
+ status_code: 200
+ body:
+ - 20001
+
+ - name: instance list 200 but empty
+ request:
+ url: http://localhost:10000/a1-p/policytypes/20001/policies
+ method: GET
+ response:
+ status_code: 200
+ body: []
+
+ - name: test the delay policy instance get not there yet
+ request:
+ url: http://localhost:10000/a1-p/policytypes/20001/policies/delaytest
+ method: GET
+ response:
+ status_code: 404
+
+ - name: test the delay policy status get not there yet
+ request:
+ url: http://localhost:10000/a1-p/policytypes/20001/policies/delaytest/status
+ method: GET
+ response:
+ status_code: 404
+
+ - name: bad body for delaytest
+ request:
+ url: http://localhost:10000/a1-p/policytypes/20001/policies/delaytest
+ method: PUT
+ json:
+ not: "welcome"
+ response:
+ status_code: 400
+
+ - name: create delay policy instance
+ request:
+ url: http://localhost:10000/a1-p/policytypes/20001/policies/delaytest
+ method: PUT
+ json:
+ test: foo
+ headers:
+ content-type: application/json
+ response:
+ status_code: 202
+
+ - name: test the delay status get, not in effect yet
+ request:
+ url: http://localhost:10000/a1-p/policytypes/20001/policies/delaytest/status
+ method: GET
+ response:
+ status_code: 200
+ body:
+ instance_status: "NOT IN EFFECT"
+ has_been_deleted: False
+
+ - name: test the delay policy get
+ request:
+ url: http://localhost:10000/a1-p/policytypes/20001/policies/delaytest
+ method: GET
+ response:
+ status_code: 200
+ body:
+ test: foo
+
+ - name: instance list 200 and there
+ request:
+ url: http://localhost:10000/a1-p/policytypes/20001/policies
+ method: GET
+ response:
+ status_code: 200
+ body:
+ - delaytest
+
+ - name: test the delay status get
+ max_retries: 3
+ delay_before: 6 # give it a few seconds for rmr ; delay reciever sleeps for 5 seconds by default
+ request:
+ url: http://localhost:10000/a1-p/policytypes/20001/policies/delaytest/status
+ method: GET
+ response:
+ status_code: 200
+ body:
+ instance_status: "IN EFFECT"
+ has_been_deleted: False
+
+ # DELETE the instance and make sure subsequent GETs return properly
+ - name: delete the instance
+ request:
+ url: http://localhost:10000/a1-p/policytypes/20001/policies/delaytest
+ method: DELETE
+ response:
+ status_code: 202
+
+ - name: test the delay status get immediately
+ request:
+ url: http://localhost:10000/a1-p/policytypes/20001/policies/delaytest/status
+ method: GET
+ response:
+ status_code: 200
+ body:
+ instance_status: "IN EFFECT"
+ has_been_deleted: True
+
+ - name: test the delay status get after delay but before timers
+ delay_before: 7
+ request:
+ url: http://localhost:10000/a1-p/policytypes/20001/policies/delaytest/status
+ method: GET
+ response:
+ status_code: 200
+ body:
+ instance_status: "NOT IN EFFECT"
+ has_been_deleted: True
+
+ - name: test the delay status get after delay and after the timers
+ delay_before: 7
+ request:
+ url: http://localhost:10000/a1-p/policytypes/20001/policies/delaytest/status
+ method: GET
+ response:
+ status_code: 404
+
+---
+
+test_name: test query