# -*- coding: utf-8 -*-
"""
Created on Fri Apr 21 12:06:50 2017

@author: richard
"""
import unittest

from tests import MailgunTestBase
from flask_mailgun.message import Message


class SendMessageTest(MailgunTestBase):
    def test_send_simple_message(self):
        message = Message(subject="Hello",
                          sender="from@example.com",
                          recipients=["u1@example.com", "u2@example.com"],
                          bcc=["foo@bar.com"],
                          body="Testing some Mailgun awesomness!")
        self.mailgun.send(message)
        self.assertTrue(self.mock_post.called)
        url = self.mock_post.call_args[0][0]
        auth = self.mock_post.call_args[1]['auth']
        data = self.mock_post.call_args[1]['data']
        # files = self.mock_post.call_args[1]['files']
        self.assertEqual(url, 'https://api.mailgun.net/v3/example.com/messages')
        self.assertEqual(auth, ('api', b'testtesttest'))
        # self.assertEqual(files, [])
        self.assertEqual(data['from'], message.sender)
        self.assertEqual(data['to'], set(message.recipients))
        self.assertEqual(data['bcc'], set(message.bcc))
        self.assertEqual(data['cc'], set())
        self.assertEqual(data['subject'], message.subject)
        self.assertEqual(data['text'], message.body)

if __name__ == '__main__':
    unittest.main()

@@ -1087,28 +1087,24 @@
 data%5B'to'%5D, 
-set(
 message.reci
@@ -1110,17 +1110,16 @@
 ipients)
-)
 %0A       
@@ -1149,20 +1149,16 @@
 'bcc'%5D, 
-set(
 message.
@@ -1161,17 +1161,16 @@
 age.bcc)
-)
 %0A       
@@ -1203,13 +1203,10 @@
 '%5D, 
-set()
+%5B%5D
 )%0A  

update tests