Changeset - fed129fb8533
[Not reviewed]
default
0 5 0
Thomas De Schampheleire - 10 years ago 2016-05-14 21:59:47
thomas.de.schampheleire@gmail.com
pytest migration: backout declassification of remove_all_notifications

In order to accomodate both nose/unittest and pytest at the same time,
method remove_all_notifications has been extracted from BaseTestCase in
commit 37d713674f63.
Now that nose/unittest is no longer used, we can backout this change again.
5 files changed with 13 insertions and 13 deletions:
0 comments (0 inline, 0 general)
kallithea/tests/__init__.py
Show inline comments
 
@@ -70,7 +70,7 @@ __all__ = [
 
    'TEST_USER_REGULAR2_PASS', 'TEST_USER_REGULAR2_EMAIL', 'TEST_HG_REPO',
 
    'TEST_HG_REPO_CLONE', 'TEST_HG_REPO_PULL', 'TEST_GIT_REPO',
 
    'TEST_GIT_REPO_CLONE', 'TEST_GIT_REPO_PULL', 'HG_REMOTE_REPO',
 
    'GIT_REMOTE_REPO', 'SCM_TESTS', 'remove_all_notifications',
 
    'GIT_REMOTE_REPO', 'SCM_TESTS',
 
]
 

	
 
# Invoke websetup with the current config file
 
@@ -161,14 +161,6 @@ def init_stack(config=None):
 
    h = NullHandler()
 
    logging.getLogger("kallithea").addHandler(h)
 

	
 
def remove_all_notifications():
 
    Notification.query().delete()
 

	
 
    # Because query().delete() does not (by default) trigger cascades.
 
    # http://docs.sqlalchemy.org/en/rel_0_7/orm/collections.html#passive-deletes
 
    UserNotification.query().delete()
 

	
 
    Session().commit()
 

	
 
class TestControllerPytest(object):
 
    """Pytest-style test controller"""
 
@@ -184,6 +176,14 @@ class TestControllerPytest(object):
 
        self.index_location = config['app_conf']['index_dir']
 
        return self.app
 

	
 
    def remove_all_notifications(self):
 
        Notification.query().delete()
 

	
 
        # Because query().delete() does not (by default) trigger cascades.
 
        # http://docs.sqlalchemy.org/en/rel_0_7/orm/collections.html#passive-deletes
 
        UserNotification.query().delete()
 
        Session().commit()
 

	
 
    def log_user(self, username=TEST_USER_ADMIN_LOGIN,
 
                 password=TEST_USER_ADMIN_PASS):
 
        self._logged_username = username
kallithea/tests/functional/test_admin_notifications.py
Show inline comments
 
@@ -9,7 +9,7 @@ from kallithea.lib import helpers as h
 

	
 
class TestNotificationsController(TestControllerPytest):
 
    def setup_method(self, method):
 
        remove_all_notifications()
 
        self.remove_all_notifications()
 

	
 
    def test_index(self):
 
        self.log_user()
kallithea/tests/functional/test_changeset_comments.py
Show inline comments
 
@@ -11,7 +11,7 @@ class TestChangeSetCommentsController(Te
 
            Session().delete(x)
 
        Session().commit()
 

	
 
        remove_all_notifications()
 
        self.remove_all_notifications()
 

	
 
    def test_create(self):
 
        self.log_user()
kallithea/tests/functional/test_login.py
Show inline comments
 
@@ -21,7 +21,7 @@ fixture = Fixture()
 

	
 
class TestLoginController(TestControllerPytest):
 
    def setup_method(self, method):
 
        remove_all_notifications()
 
        self.remove_all_notifications()
 
        assert Notification.query().all() == []
 

	
 
    def test_index(self):
kallithea/tests/models/test_notifications.py
Show inline comments
 
@@ -32,7 +32,7 @@ class TestNotifications(TestControllerPy
 
        Session().commit()
 
        self.u3 = self.u3.user_id
 

	
 
        remove_all_notifications()
 
        self.remove_all_notifications()
 
        assert [] == Notification.query().all()
 
        assert [] == UserNotification.query().all()
 

	
0 comments (0 inline, 0 general)