uri_test_brain.yml 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. ---
  2. # GET
  3. - name: "test-get-url"
  4. signals:
  5. - order: "test-get-url"
  6. neurons:
  7. - uri:
  8. url: "http://jsonplaceholder.typicode.com/posts/1"
  9. file_template: "neurons/uri/tests/test_get_template.j2"
  10. # POST
  11. - name: "test-post-url"
  12. signals:
  13. - order: "test-post-url"
  14. neurons:
  15. - uri:
  16. url: "http://jsonplaceholder.typicode.com/posts"
  17. headers:
  18. user-agent: 'my-app/0.0.1'
  19. Content-Type: 'application/json'
  20. timeout: 12
  21. method: POST
  22. data_from_file: "neurons/uri/tests/data_post_test.json"
  23. say_template:
  24. - "{{ content.id }}"
  25. # POST with auth
  26. - name: "test-post-url-with-auth"
  27. signals:
  28. - order: "test-post-url-with-auth"
  29. neurons:
  30. - uri:
  31. url: "http://192.168.0.17:8000/app"
  32. headers:
  33. Content-Type: 'application/json'
  34. method: POST
  35. user: "admin"
  36. password: "secret"
  37. data_from_file: "neurons/uri/tests/data_post_test.json"
  38. # PUT
  39. - name: "test-put-url"
  40. signals:
  41. - order: "test-put-url"
  42. neurons:
  43. - uri:
  44. url: "http://jsonplaceholder.typicode.com/posts/1"
  45. method: PUT
  46. data: "{\"id\": 1,\"title\": \"foo\", \"body\": \"bar\", \"userId\": 1}"
  47. # PATCH
  48. - name: "test-patch-url"
  49. signals:
  50. - order: "test-patch-url"
  51. neurons:
  52. - uri:
  53. url: "http://jsonplaceholder.typicode.com/posts/1"
  54. method: PATCH
  55. data: "{\"title\": \"foo\"}"
  56. # DELETE
  57. - name: "test-delete-url"
  58. signals:
  59. - order: "test-delete-url"
  60. neurons:
  61. - uri:
  62. url: "http://jsonplaceholder.typicode.com/posts/1"
  63. method: DELETE
  64. timeout: 2
  65. say_template:
  66. - "{% if status_code==200 %}delete complete{% else %}fail to delete{% endif %}"