Skip to content

Commit

Permalink
Convert www.security test suite to pytest and remove residuals (#18961)
Browse files Browse the repository at this point in the history
Co-authored-by: Tzu-ping Chung <[email protected]>
  • Loading branch information
khalidmammadov and uranusjr authored Nov 30, 2021
1 parent 9a469d8 commit 33a4502
Show file tree
Hide file tree
Showing 4 changed files with 691 additions and 567 deletions.
16 changes: 12 additions & 4 deletions tests/test_utils/api_connexion_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,23 @@ def create_role(app, name, permissions=None):
return role


def set_user_single_role(app, username, role_name):
role = create_role(app, role_name)
user = app.appbuilder.sm.find_user(username)
if role not in user.roles:
user.roles = [role]
app.appbuilder.sm.update_user(user)


def delete_role(app, name):
if app.appbuilder.sm.find_role(name):
app.appbuilder.sm.delete_role(name)
if name not in EXISTING_ROLES:
if app.appbuilder.sm.find_role(name):
app.appbuilder.sm.delete_role(name)


def delete_roles(app):
for role in app.appbuilder.sm.get_all_roles():
if role.name not in EXISTING_ROLES:
app.appbuilder.sm.delete_role(role.name)
delete_role(app, role.name)


def delete_user(app, username):
Expand Down
Loading

0 comments on commit 33a4502

Please sign in to comment.