sobjects/test/unittest_notification.py
changeset 2058 7ef12c03447c
parent 1977 606923dff11b
child 2637 07103211e511
equal deleted inserted replaced
2057:0a0cbccafcb5 2058:7ef12c03447c
    54         self.execute('INSERT EmailAddress X: X address "admin@logilab.fr", U primary_email X '
    54         self.execute('INSERT EmailAddress X: X address "admin@logilab.fr", U primary_email X '
    55                      'WHERE U eid %(x)s', {'x': urset[0][0]})
    55                      'WHERE U eid %(x)s', {'x': urset[0][0]})
    56         self.execute('INSERT CWProperty X: X pkey "ui.language", X value "fr", X for_user U '
    56         self.execute('INSERT CWProperty X: X pkey "ui.language", X value "fr", X for_user U '
    57                      'WHERE U eid %(x)s', {'x': urset[0][0]})
    57                      'WHERE U eid %(x)s', {'x': urset[0][0]})
    58         self.commit() # commit so that admin get its properties updated
    58         self.commit() # commit so that admin get its properties updated
    59         finder = self.vreg.select_component('recipients_finder', self.request(), urset)
    59         finder = self.vreg.select('components', 'recipients_finder', self.request(),
       
    60                                   rset=urset)
    60         self.set_option('default-recipients-mode', 'none')
    61         self.set_option('default-recipients-mode', 'none')
    61         self.assertEquals(finder.recipients(), [])
    62         self.assertEquals(finder.recipients(), [])
    62         self.set_option('default-recipients-mode', 'users')
    63         self.set_option('default-recipients-mode', 'users')
    63         self.assertEquals(finder.recipients(), [(u'admin@logilab.fr', 'fr')])
    64         self.assertEquals(finder.recipients(), [(u'admin@logilab.fr', 'fr')])
    64         self.set_option('default-recipients-mode', 'default-dest-addrs')
    65         self.set_option('default-recipients-mode', 'default-dest-addrs')
    71     def test_status_change_view(self):
    72     def test_status_change_view(self):
    72         req = self.session()
    73         req = self.session()
    73         u = self.create_user('toto', req=req)
    74         u = self.create_user('toto', req=req)
    74         assert u.req
    75         assert u.req
    75         self.execute('SET X in_state S WHERE X eid %s, S name "deactivated"' % u.eid)
    76         self.execute('SET X in_state S WHERE X eid %s, S name "deactivated"' % u.eid)
    76         v = self.vreg.select_view('notif_status_change', req, u.rset, row=0)
    77         v = self.vreg.select('views', 'notif_status_change', req, u.rset, row=0)
    77         content = v.render(row=0, comment='yeah',
    78         content = v.render(row=0, comment='yeah',
    78                            previous_state='activated',
    79                            previous_state='activated',
    79                            current_state='deactivated')
    80                            current_state='deactivated')
    80         # remove date
    81         # remove date
    81         self.assertEquals(content,
    82         self.assertEquals(content,