uri_test_brain.yml 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. timeout: 12
  20. method: POST
  21. data_from_file: "neurons/uri/tests/data_post_test.json"
  22. say_template:
  23. - "{{ content.id }}"
  24. # PUT
  25. - name: "test-put-url"
  26. signals:
  27. - order: "test-put-url"
  28. neurons:
  29. - uri:
  30. url: "http://jsonplaceholder.typicode.com/posts/1"
  31. method: PUT
  32. data: "{\"id\": 1,\"title\": \"foo\", \"body\": \"bar\", \"userId\": 1}"
  33. # PATCH
  34. - name: "test-patch-url"
  35. signals:
  36. - order: "test-patch-url"
  37. neurons:
  38. - uri:
  39. url: "http://jsonplaceholder.typicode.com/posts/1"
  40. method: PATCH
  41. data: "{\"title\": \"foo\"}"
  42. # DELETE
  43. - name: "test-delete-url"
  44. signals:
  45. - order: "test-delete-url"
  46. neurons:
  47. - uri:
  48. url: "http://jsonplaceholder.typicode.com/posts/1"
  49. method: DELETE
  50. say_template:
  51. - "{% if status_code==200 %}delete complete{% else %}fail to delete{% endif %}"