Esempio n. 1
0
  def test_email_notification(self):
    # new follower

    r = self.login('hermit')
    params = {'actor_add_contact': '',
              'owner': '*****@*****.**',
              'target': '*****@*****.**',
              '_nonce': util.create_nonce('*****@*****.**', 
                                          'actor_add_contact')
              }
    r = self.client.post('/user/popular', params)
    
    self.assertEqual(len(mail.outbox), 1, 'new follower')
    
    email = mail.outbox[0]
    # test that the link is valid
    url = test_util.get_relative_url(email.body)

    r = self.client.get(url)
    self.assertTemplateUsed(r, 'history.html')
    
    mail.outbox = []
    
    # new follower mutual
    r = self.login('popular')
    params = {'actor_add_contact': '',
              'owner': '*****@*****.**',
              'target': '*****@*****.**',
              '_nonce': util.create_nonce('*****@*****.**', 
                                          'actor_add_contact')
              }
    r = self.client.post('/user/unpopular', params)
    
    self.assertEqual(len(mail.outbox), 1, 'new follower mutual')
    
    email = mail.outbox[0]

    # test that the link is valid
    url = test_util.get_relative_url(email.body)
    r = self.client.get(url)
    self.assertTemplateUsed(r, 'history.html')
Esempio n. 2
0
 def test_email_notification(self):
   r = self.login('hermit')
   content = 'TEST COMMENT'
   params = {'entry_add_comment': '',
             'nick': '*****@*****.**',
             'stream': 'stream/[email protected]/presence',
             'entry': self.entry,
             'content': content,
             '_nonce': util.create_nonce('*****@*****.**', 
                                         'entry_add_comment')
             }
   r = self.client.post('/user/popular/presence/12345',
                        params)
   self.exhaust_queue_any()
   
   self.assertEqual(len(mail.outbox), 2)
   for email in mail.outbox:
     # test that the link is valid
     url = test_util.get_relative_url(email.body)
     r = self.client.get(url)
     self.assertContains(r, content)
     self.assertTemplateUsed(r, 'item.html')