Exemple #1
0
    def test_mail_utils(self):
        from zabo.mail_utils import mailbody_transfer_received
        # first, create an abo in the DB and thus an id to match
        new_abo = Abo(
            name=u'foobar',
            email=u'*****@*****.**',
            amount=u'23'
        )
        new_abo.linkcode = u'ABCDEFGHIJKAbo'
        new_abo.locale = u'de'
        DBSession.add(new_abo)
        DBSession.flush()
        assert(new_abo.id == 2)
        old_abo = Abo.get_by_id(1)
        old_abo.locale = u'en'
        _url = 'http://foobar.com'
        # englisch
        result1 = mailbody_transfer_received(old_abo, _url)
        #print result1
        self.assertTrue('Hello' in result1)

        # german
        result2 = mailbody_transfer_received(new_abo, _url)
        #print result2
        self.assertTrue('Hallo' in result2)
Exemple #2
0
 def _insert_abos(self):
     with transaction.manager:
         abo1 = Abo(  # english
             name=u'SomeAliasnäme',
             email=u'*****@*****.**',
             amount=u'23',
         )
         abo1.locale = u'en'
         abo2 = Abo(  # german
             name=u'AAASomeFirstnäme',
             email=u'*****@*****.**',
             amount=u'42',
         )
         abo2.locale = u'de'
         DBSession.add(abo1)
         DBSession.add(abo2)
         DBSession.flush()
Exemple #3
0
 def setUp(self):
     super(ZaboModelTests, self).setUp()
     with transaction.manager:
         abo1 = Abo(  # englisch
             name=u'SomeFirstnäme',
             email=u'*****@*****.**',
             amount=u"12345",
         )
         abo1.locale = u'en'
         abo1.refcode = u'ABCXXSustainC3S'
         DBSession.add(abo1)
         abo2 = Abo(  # german
             name=u'SomeOthernäme',
             email=u'*****@*****.**',
             amount=u"12345",
         )
         abo2.locale = u'de'
         DBSession.add(abo2)
         DBSession.flush()
Exemple #4
0
    def test_html_and_png(self):
        """
        load the page and image for use by the sponsor
        """
        # make
        from zabo.models import Abo
        new_abo = Abo(
            name=u'oleander',
            email=u'*****@*****.**',
            amount=u'23',
        )
        new_abo.locale = u'de'
        # set the linkcode to sth, which is usually done via button in backend
        new_abo.linkcode = u'YES_THIS_ONE'
        DBSession.add(new_abo)
        DBSession.flush()

        '''
        image
        '''
        image = self.testapp.get(
            '/verify/{}.png'.format(new_abo.linkcode), status=200)
        #print len(image.body)
        self.failUnless(85000 < len(image.body) < 90000)  # check size of image
        '''
        html page
        '''
        html = self.testapp.get(
            '/verify/{}.html'.format(new_abo.linkcode), status=200)
        #print html.body
        # link to image must be in html
        self.failUnless(
            '/verify/{}.png'.format(new_abo.linkcode) in html.body)
        self.failUnless('<small>Thanks,</small>' in html.body)
        #self.failUnless('<small>Contribution by</small>' in html.body)
        self.failUnless(new_abo.name in html.body)