Exemplo n.º 1
0
 def test_basic(self):
     # Very basic test... just see that url exists.
     u = self.new_tracker('tracker')
     e = Email(tracker=u, subject='X', txtmsg='Y', htmlmsg='Z')
     e.save()
     id = e.pk
     self.create_users(1)
     with self.scoped_login('user0', 'password'):
         url = urlreverse('linkanalytics-email-viewunread', 
                          kwargs={'emailid':id})
         response = self.client.get(url)
         self.assertEquals(response.status_code, 200)
Exemplo n.º 2
0
 def test_oneSent(self):
     # When an email was sent
     self.create_users(1)
     u = self.new_tracker('tracker')
     e = Email(tracker=u, subject='X', txtmsg='Y', htmlmsg='Z')
     e.save()
     id = e.pk
     with self.scoped_login('user0', 'password'):
         url = urlreverse('linkanalytics-email-viewsent')
         response = self.client.get(url)
         self.assertEquals(response.status_code, 200)
         self.assertEquals(len(response.context['emails']), 1)
         self.assertEquals(response.context['emails'][0].pk, id)
Exemplo n.º 3
0
 def test_sent_count(self):
     u = self.new_tracker('tracker')
     self.create_users(1)
     with self.scoped_login('user0', 'password'):
         url = urlreverse('linkanalytics-email-main')
         # Case 1: no emails
         response = self.client.get(url)
         self.assertEquals(response.context['sent_count'], 0)
         
         # Case 2: one sent email
         e = Email(tracker=u, subject='X', txtmsg='Y', htmlmsg='Z')
         e.save()
         response = self.client.get(url)
         self.assertEquals(response.context['sent_count'], 1)
Exemplo n.º 4
0
 def new_email(self, *args, **kwargs):
     """Creates and saves an Email"""
     e = Email(**kwargs)
     e.save()
     return e
Exemplo n.º 5
0
 def sendEmail():
     u = self.new_tracker('tracker')
     e = Email(tracker=u, subject='X', txtmsg='Y', htmlmsg='Z')
     e.save()
     return e.pk