checkpoint 2 part 1 finished, needs to be properly tested
This commit is contained in:
parent
ce3ea05831
commit
c3f67d4582
14 changed files with 306 additions and 26 deletions
|
@ -1,14 +0,0 @@
|
|||
---
|
||||
|
||||
- name: Refresh inventory
|
||||
meta: refresh_inventory
|
||||
|
||||
- name: Check that you can connect (GET) to App and it returns a status 200
|
||||
ansible.builtin.uri:
|
||||
url: "http://{{ app_ip }}:{{app_port}}/"
|
||||
method: GET
|
||||
status_code: 200
|
||||
register: result
|
||||
until: result.status == 200
|
||||
retries: 3
|
||||
delay: 5
|
14
roles/test_laravelio/test_access/tasks/main.yml
Normal file
14
roles/test_laravelio/test_access/tasks/main.yml
Normal file
|
@ -0,0 +1,14 @@
|
|||
---
|
||||
|
||||
- name: Refresh inventory
|
||||
meta: refresh_inventory
|
||||
|
||||
- name: Test Access - Check access to App (HTTP GET should return {{app_status_code}})
|
||||
ansible.builtin.uri:
|
||||
url: "http://{{ app_ip }}:{{app_port}}/"
|
||||
method: GET
|
||||
status_code: "{{app_status_code}}"
|
||||
register: result
|
||||
until: result.status == app_status_code
|
||||
retries: 6
|
||||
delay: 30
|
53
roles/test_laravelio/test_login/tasks/main.yml
Normal file
53
roles/test_laravelio/test_login/tasks/main.yml
Normal file
|
@ -0,0 +1,53 @@
|
|||
---
|
||||
|
||||
- name: Refresh inventory
|
||||
meta: refresh_inventory
|
||||
|
||||
- name: Test Login - Get Login page (HTTP GET should return 200)
|
||||
ansible.builtin.uri:
|
||||
url: "http://{{ app_ip }}:{{app_port}}/login"
|
||||
method: GET
|
||||
status_code: 200
|
||||
timeout: 300
|
||||
dest: /tmp/index.html
|
||||
register: result
|
||||
|
||||
- name: Test Login - Extract CSRF token
|
||||
shell: cat /tmp/index.html | grep "csrf-token" | sed "s/.* content=\"\(.*\)\".*/\1/"
|
||||
register: parse_res
|
||||
|
||||
- set_fact:
|
||||
token: "{{parse_res.stdout_lines[0]}}"
|
||||
|
||||
- name: Test Login - Login as testing user (HTTP POST should return 302)
|
||||
ansible.builtin.uri:
|
||||
url: "http://{{ app_ip }}:{{app_port}}/login"
|
||||
method: POST
|
||||
body:
|
||||
username: "testing"
|
||||
password: "password"
|
||||
_token: "{{token}}"
|
||||
body_format: json
|
||||
return_content: true
|
||||
dest: /tmp/login.html
|
||||
status_code: 302
|
||||
timeout: 300
|
||||
headers:
|
||||
Cookie: "{{ result.cookies_string }}"
|
||||
Cache-Control: no-cache
|
||||
Content-Type: 'application/json; charset=UTF-8'
|
||||
validate_certs: false
|
||||
register: login
|
||||
|
||||
- name: Test Login - Get User page (HTTP GET should return 200)
|
||||
ansible.builtin.uri:
|
||||
url: "http://{{ app_ip }}:{{app_port}}/user"
|
||||
method: GET
|
||||
status_code: 200
|
||||
follow_redirects: true
|
||||
dest: /tmp/index.html
|
||||
headers:
|
||||
Cookie: "{{ login.set_cookie }}"
|
||||
register: user_page
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue