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'])
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
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'])
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'])
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
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
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'])