예제 #1
0
 def test_set_subscriber(self):
     api = BlueHornetAPI(settings.BLUE_HORNET_API_KEY,
                         settings.BLUE_HORNET_API_SECRET)
     response = api.set_subscriber(email='*****@*****.**',
                                   firstname='Test',
                                   lastname='Subscriber')
     self.assertEquals('1', response['methodResponse']['item'][0]['responseData']['valid'])
예제 #2
0
 def test_check_email_address(self):
     api = BlueHornetAPI(settings.BLUE_HORNET_API_KEY,
                         settings.BLUE_HORNET_API_SECRET)
     response = api.check_email('*****@*****.**','*****@*****.**')
     self.assertEquals('1', response['methodResponse']['item'][0]['responseData']['valid'])
     self.assertEquals('0', response['methodResponse']['item'][1]['responseData']['valid'])
     print response
예제 #3
0
 def test_set_subscriber(self):
     api = BlueHornetAPI(settings.BLUE_HORNET_API_KEY,
                         settings.BLUE_HORNET_API_SECRET)
     response = api.set_subscriber(email='*****@*****.**',
                                   firstname='Test',
                                   lastname='Subscriber')
     self.assertEquals(
         '1',
         response['methodResponse']['item'][0]['responseData']['valid'])
예제 #4
0
 def test_retrieve_active(self):
     api = BlueHornetAPI(settings.BLUE_HORNET_API_KEY,
                         settings.BLUE_HORNET_API_SECRET)
     response = api.retrieve_active(extended='1')
     self.assertEquals(
         '1',
         response['methodResponse']['item'][0]['responseData']['valid'])
     self.assertEquals(
         '0',
         response['methodResponse']['item'][1]['responseData']['valid'])
예제 #5
0
 def test_check_email_address(self):
     api = BlueHornetAPI(settings.BLUE_HORNET_API_KEY,
                         settings.BLUE_HORNET_API_SECRET)
     response = api.check_email('*****@*****.**', '*****@*****.**')
     self.assertEquals(
         '1',
         response['methodResponse']['item'][0]['responseData']['valid'])
     self.assertEquals(
         '0',
         response['methodResponse']['item'][1]['responseData']['valid'])
     print response
예제 #6
0
 def send_messages(self, email_messages):
     """
     Sends one or more EmailMessage objects and returns the number of email
     messages sent.
     """
     if not email_messages:
         return
     self._lock.acquire()
     try:
         api = BlueHornetAPI(self.host, self.port, self.username,
                 self.password)
         num_sent = 0
         for message in email_messages:
             sent = api.send(message)
             if sent:
                 num_sent += 1
     finally:
         self._lock.release()
     return num_sent
예제 #7
0
 def test_retrieve_active(self):
     api = BlueHornetAPI(settings.BLUE_HORNET_API_KEY,
                         settings.BLUE_HORNET_API_SECRET)
     response = api.retrieve_active(extended='1')
     self.assertEquals('1', response['methodResponse']['item'][0]['responseData']['valid'])
     self.assertEquals('0', response['methodResponse']['item'][1]['responseData']['valid'])