mysql_query, mysql_user: simple refactoring of type checks (#58)

* mysql_query: simple refactoring of query type check

* do the same for mysql_user

* Improve integration test coverage
This commit is contained in:
Andrew Klychkov 2020-11-06 13:12:07 +03:00 committed by GitHub
commit 2dcbd7846f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 2 deletions

View file

@ -192,6 +192,25 @@
- "'%db' in result.stdout"
- "'SELECT' in result.stdout"
- name: test priv type check, must fail
mysql_user:
<<: *mysql_params
name: '{{ user_name_1 }}'
priv:
- unsuitable
- type
append_privs: yes
host_all: yes
password: '{{ user_password_1 }}'
register: result
ignore_errors: yes
- name: check fail message
assert:
that:
- result is failed
- result.msg is search('priv parameter must be str or dict')
- name: change user access to database via wildcard
mysql_user:
<<: *mysql_params