Refactor tests to use is succeeded or is failed

This commit is contained in:
Laurent Indermuehle 2022-08-22 14:30:13 +02:00
commit d93b27e120
No known key found for this signature in database
GPG key ID: 93FA944C9F34DD09
6 changed files with 24 additions and 24 deletions

View file

@ -398,7 +398,7 @@
- assert: - assert:
that: that:
- result.failed == true - result is failed
- name: try to import with force parameter - name: try to import with force parameter
mysql_db: mysql_db:

View file

@ -95,7 +95,7 @@
- name: assert test mysql_db encoding param not valid - issue 8075 (failed=true) - name: assert test mysql_db encoding param not valid - issue 8075 (failed=true)
assert: assert:
that: that:
- "result.failed == true" - result is failed
- "'Traceback' not in result.msg" - "'Traceback' not in result.msg"
- "'Unknown character set' in result.msg" - "'Unknown character set' in result.msg"
@ -233,7 +233,7 @@
- name: assert output message that database was not created using dbuser2 - name: assert output message that database was not created using dbuser2
assert: assert:
that: that:
- "result.failed == true" - result is failed
- "'Access denied' in result.msg" - "'Access denied' in result.msg"
- name: run command to test that database was not created - name: run command to test that database was not created
@ -260,7 +260,7 @@
- name: assert output message that database was not deleted using dbuser2 - name: assert output message that database was not deleted using dbuser2
assert: assert:
that: that:
- "result.failed == true" - result is failed
- "'Access denied' in result.msg" - "'Access denied' in result.msg"
- name: run command to test database was not deleted - name: run command to test database was not deleted

View file

@ -225,7 +225,7 @@
- assert: - assert:
that: that:
- result.failed == true - result is failed
- name: Check the prev rename - name: Check the prev rename
mysql_query: mysql_query:

View file

@ -49,7 +49,7 @@
- name: Assert that mysql_info was successful - name: Assert that mysql_info was successful
assert: assert:
that: that:
- "result.failed == false" - result is succeeded
- name: Run mysql_user again without any changes - name: Run mysql_user again without any changes
mysql_user: mysql_user:
@ -95,7 +95,7 @@
- name: Assert that the mysql_info module failed because we used the old password - name: Assert that the mysql_info module failed because we used the old password
assert: assert:
that: that:
- "result.failed == true" - result is failed
- name: Get the MySQL version data using the new password (should work) - name: Get the MySQL version data using the new password (should work)
mysql_info: mysql_info:
@ -110,7 +110,7 @@
- name: Assert that the mysql_info module succeeded because we used the new password - name: Assert that the mysql_info module succeeded because we used the new password
assert: assert:
that: that:
- "result.failed == false" - result is succeeded
# Cleanup # Cleanup
- include: remove_user.yml user_name={{ test_user_name }} user_password={{ new_password }} - include: remove_user.yml user_name={{ test_user_name }} user_password={{ new_password }}
@ -187,7 +187,7 @@
- name: Assert that the mysql_info module succeeded because we used the new password - name: Assert that the mysql_info module succeeded because we used the new password
assert: assert:
that: that:
- "result.failed == false" - result is succeeded
- name: Pass in the same password as before, but in the encrypted form (no change expected) - name: Pass in the same password as before, but in the encrypted form (no change expected)
mysql_user: mysql_user:
@ -235,7 +235,7 @@
- name: Assert that mysql_info was successful - name: Assert that mysql_info was successful
assert: assert:
that: that:
- "result.failed == false" - result is succeeded
- name: Get the MySQL version using an non-empty password (should fail) - name: Get the MySQL version using an non-empty password (should fail)
mysql_info: mysql_info:
@ -250,7 +250,7 @@
- name: Assert that mysql_info failed - name: Assert that mysql_info failed
assert: assert:
that: that:
- "result.failed == true" - result is failed
- name: Update the user without changing the password - name: Update the user without changing the password
mysql_user: mysql_user:

View file

@ -59,7 +59,7 @@
- name: Assert that mysql_info was successful - name: Assert that mysql_info was successful
assert: assert:
that: that:
- "result.failed == false" - result is succeeded
- name: Update the user with a different hash - name: Update the user with a different hash
mysql_user: mysql_user:
@ -88,7 +88,7 @@
- name: Assert that mysql_info was successful - name: Assert that mysql_info was successful
assert: assert:
that: that:
- "result.failed == false" - result is succeeded
# Cleanup # Cleanup
- include: remove_user.yml user_name={{ test_user_name }} user_password={{ test_plugin_new_auth_string }} - include: remove_user.yml user_name={{ test_user_name }} user_password={{ test_plugin_new_auth_string }}
@ -135,7 +135,7 @@
- name: Assert that mysql_info was successful - name: Assert that mysql_info was successful
assert: assert:
that: that:
- "result.failed == false" - result is succeeded
- name: Update the user with the same hash (no change expected) - name: Update the user with the same hash (no change expected)
mysql_user: mysql_user:
@ -180,7 +180,7 @@
- name: Assert that mysql_info was successful - name: Assert that mysql_info was successful
assert: assert:
that: that:
- "result.failed == false" - result is succeeded
# Cleanup # Cleanup
- include: remove_user.yml user_name={{ test_user_name }} user_password={{ test_plugin_auth_string }} - include: remove_user.yml user_name={{ test_user_name }} user_password={{ test_plugin_auth_string }}
@ -227,7 +227,7 @@
- name: Assert that mysql_info was successful - name: Assert that mysql_info was successful
assert: assert:
that: that:
- "result.failed == false" - result is succeeded
- name: Update the user with the same auth string - name: Update the user with the same auth string
mysql_user: mysql_user:
@ -271,7 +271,7 @@
- name: Assert that mysql_info was successful - name: Assert that mysql_info was successful
assert: assert:
that: that:
- "result.failed == false" - result is succeeded
# Cleanup # Cleanup
- include: remove_user.yml user_name={{ test_user_name }} user_password={{ test_plugin_auth_string }} - include: remove_user.yml user_name={{ test_user_name }} user_password={{ test_plugin_auth_string }}
@ -318,7 +318,7 @@
- name: Assert that mysql_info was successful - name: Assert that mysql_info was successful
assert: assert:
that: that:
- "result.failed == false" - result is succeeded
- name: Get the MySQL version using an non-empty password (should fail) - name: Get the MySQL version using an non-empty password (should fail)
mysql_info: mysql_info:
@ -333,7 +333,7 @@
- name: Assert that mysql_info failed - name: Assert that mysql_info failed
assert: assert:
that: that:
- "result.failed == true" - result is failed
- name: Update the user without changing the auth mechanism - name: Update the user without changing the auth mechanism
mysql_user: mysql_user:

View file

@ -22,4 +22,4 @@
- name: assert message failure (expect failed=true) - name: assert message failure (expect failed=true)
assert: assert:
that: that:
- "output.failed | bool == true" - output is failed