sobjects/test/unittest_supervising.py
branchstable
changeset 4842 3653e09024a1
parent 4252 6c4f109c2b03
child 5174 78438ad513ca
child 5421 8167de96c523
equal deleted inserted replaced
4841:0b9a842ec4f7 4842:3653e09024a1
    25         self.execute('SET C comments B WHERE B title "une autre news !", C content "Yo !"')
    25         self.execute('SET C comments B WHERE B title "une autre news !", C content "Yo !"')
    26         self.vreg.config.global_set_option('supervising-addrs', 'test@logilab.fr')
    26         self.vreg.config.global_set_option('supervising-addrs', 'test@logilab.fr')
    27 
    27 
    28 
    28 
    29     def test_supervision(self):
    29     def test_supervision(self):
    30         session = self.session
       
    31         # do some modification
    30         # do some modification
    32         user = self.execute('INSERT CWUser X: X login "toto", X upassword "sosafe", X in_group G '
    31         user = self.execute('INSERT CWUser X: X login "toto", X upassword "sosafe", X in_group G '
    33                             'WHERE G name "users"').get_entity(0, 0)
    32                             'WHERE G name "users"').get_entity(0, 0)
    34         self.execute('SET X last_login_time NOW WHERE X eid %(x)s', {'x': user.eid}, 'x')
    33         self.execute('SET X last_login_time NOW WHERE X eid %(x)s', {'x': user.eid}, 'x')
    35         self.execute('DELETE Card B WHERE B title "une news !"')
    34         self.execute('DELETE Card B WHERE B title "une news !"')
    36         self.execute('SET X bookmarked_by U WHERE X is Bookmark, U eid %(x)s', {'x': user.eid}, 'x')
    35         self.execute('SET X bookmarked_by U WHERE X is Bookmark, U eid %(x)s', {'x': user.eid}, 'x')
    37         self.execute('SET X content "duh?" WHERE X is Comment')
    36         self.execute('SET X content "duh?" WHERE X is Comment')
    38         self.execute('DELETE X comments Y WHERE Y is Card, Y title "une autre news !"')
    37         self.execute('DELETE X comments Y WHERE Y is Card, Y title "une autre news !"')
    39         # check only one supervision email operation
    38         # check only one supervision email operation
       
    39         session = self.session
    40         sentops = [op for op in session.pending_operations
    40         sentops = [op for op in session.pending_operations
    41                    if isinstance(op, SupervisionMailOp)]
    41                    if isinstance(op, SupervisionMailOp)]
    42         self.assertEquals(len(sentops), 1)
    42         self.assertEquals(len(sentops), 1)
    43         # check view content
    43         # check view content
    44         op = sentops[0]
    44         op = sentops[0]