This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/master by this push:
     new 6d268ab  Properly remove user for test_create_user (#15981)
6d268ab is described below

commit 6d268abc621cc0ad60a2bd11148c6282735687f3
Author: Tzu-ping Chung <[email protected]>
AuthorDate: Thu May 27 13:16:23 2021 +0800

    Properly remove user for test_create_user (#15981)
---
 tests/www/views/test_views_base.py | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/tests/www/views/test_views_base.py 
b/tests/www/views/test_views_base.py
index f16e17a..84a1ea6 100644
--- a/tests/www/views/test_views_base.py
+++ b/tests/www/views/test_views_base.py
@@ -333,11 +333,13 @@ def test_views_post_access_denied(viewer_client, url):
 @pytest.fixture()
 def non_exist_username(app):
     username = "fake_username"
-    if app.appbuilder.sm.find_user(username):
-        app.appbuilder.sm.del_register_user(username)
+    user = app.appbuilder.sm.find_user(username)
+    if user is not None:
+        app.appbuilder.sm.del_register_user(user)
     yield username
-    if app.appbuilder.sm.find_user(username):
-        app.appbuilder.sm.del_register_user(username)
+    user = app.appbuilder.sm.find_user(username)
+    if user is not None:
+        app.appbuilder.sm.del_register_user(user)
 
 
 def test_create_user(app, admin_client, non_exist_username):

Reply via email to