Changeset - b8f77a47d485
[Not reviewed]
default
0 1 0
Mads Kiilerich - 6 years ago 2019-05-23 00:06:55
mads@kiilerich.com
tests: make a commit in auto_clear_ip_permissions

Sometimes, test_delete_ip would fail because UserIpMap entries left behind. It
was perhaps because a commit was missing and sessions thus sometimes were leaked?
1 file changed with 2 insertions and 0 deletions:
0 comments (0 inline, 0 general)
kallithea/tests/conftest.py
Show inline comments
 
@@ -145,24 +145,26 @@ def auto_clear_ip_permissions():
 
    user_model = UserModel()
 

	
 
    user_ids = []
 
    user_ids.append(User.get_default_user().user_id)
 
    user_ids.append(User.get_by_username(TEST_USER_REGULAR_LOGIN).user_id)
 

	
 
    for user_id in user_ids:
 
        for ip in UserIpMap.query().filter(UserIpMap.user_id == user_id):
 
            user_model.delete_extra_ip(user_id, ip.ip_id)
 

	
 
    # IP permissions are cached, need to invalidate this cache explicitly
 
    invalidate_all_caches()
 
    session = Session()
 
    session.commit()
 

	
 

	
 
@pytest.fixture
 
def test_context_fixture(app_fixture):
 
    """
 
    Encompass the entire test using this fixture in a test_context,
 
    making sure that certain functionality still works even if no call to
 
    self.app.get/post has been made.
 
    The typical error message indicating you need a test_context is:
 
        TypeError: No object (name: context) has been registered for this thread
 

	
 
    The standard way to fix this is simply using the test_context context
0 comments (0 inline, 0 general)