--- - name: Verify hosts: all gather_facts: false vars_files: - ../../defaults/main.yml tasks: - name: check if webserver is up uri: url: http://localhost:8000 status_code: [200, 302] return_content: yes register: landingpage failed_when: "'Sign in' not in landingpage.content" - name: check if document posting works uri: url: http://localhost:8000/api/documents/post_document/ method: POST body_format: form-multipart body: document: content: FOO filename: document.txt mime_type: text/plain headers: Authorization: 'Basic {{ (paperlessng_superuser_name + ":" + paperlessng_superuser_password) | b64encode }}' return_content: yes register: post_document failed_when: "'OK' not in post_document.content" - name: verify uploaded document has been accepted uri: url: http://localhost:8000/api/logs/ headers: Authorization: 'Basic {{ (paperlessng_superuser_name + ":" + paperlessng_superuser_password) | b64encode }}' return_content: yes register: logs failed_when: "'Consuming document.txt' not in logs.content" # assumes txt consumption finished by now, might have to sleep a bit - name: verify uploaded document has been consumed uri: url: http://localhost:8000/api/logs/ headers: Authorization: 'Basic {{ (paperlessng_superuser_name + ":" + paperlessng_superuser_password) | b64encode }}' return_content: yes register: logs failed_when: "'document consumption finished' not in logs.content" - name: verify uploaded document is avaiable uri: url: http://localhost:8000/api/documents/1/ headers: Authorization: 'Basic {{ (paperlessng_superuser_name + ":" + paperlessng_superuser_password) | b64encode }}' return_content: yes register: document failed_when: "'Not found.' in document.content or 'FOO' not in document.content"