Beispiel #1
0
 def test_build_query_params(self, func):
     m = Mailupy('username', 'password', 'client-id', 'client-secret')
     query = m._parse_filter_ordering(
         filter_by='Name.Contains(\'Farmacie\')',
         order_by=['Name asc', 'idGroup desc'])
     assert query == 'filterby=Name.Contains%28%27Farmacie%27%29&orderby=Name+asc%3BidGroup+desc'
     query = m._parse_filter_ordering(
         filter_by='Name.Contains(\'Farmacie\')')
     assert query == 'filterby=Name.Contains%28%27Farmacie%27%29'
     query = m._parse_filter_ordering(order_by=['Name asc', 'idGroup desc'])
     assert query == 'orderby=Name+asc%3BidGroup+desc'
Beispiel #2
0
 def test_get_fields(self, func):
     m = Mailupy('username', 'password', 'client-id', 'client-secret')
     assert list(m.get_fields())[0]['Id'] == 27
Beispiel #3
0
 def test_refresh_token(self, func):
     m = Mailupy('username', 'password', 'client-id', 'client-secret')
     m._token = 'bad_token'
     list(m.get_fields())
     assert m._token == 'good_token'
Beispiel #4
0
 def test_unsubscribe_from_group(self, func):
     m = Mailupy('username', 'password', 'client-id', 'client-secret')
     assert m.unsubscribe_from_group(6, 18)
Beispiel #5
0
 def test_remove_from_list(self, func):
     m = Mailupy('username', 'password', 'client-id', 'client-secret')
     assert m.remove_from_list(1, 18)
Beispiel #6
0
 def test_subscribe_to_group(self, func):
     m = Mailupy('username', 'password', 'client-id', 'client-secret')
     assert m.subscribe_to_group(6, 'ASDFGHJKL', '*****@*****.**',
                                 {'test': 'test'}) == 18
Beispiel #7
0
 def test_update_customer_fields(self, func):
     m = Mailupy('username', 'password', 'client-id', 'client-secret')
     assert m.update_customer_fields('ASDFGHJKL', '*****@*****.**',
                                     {'test': 'test1'})['idRecipient'] == 18
Beispiel #8
0
 def test_create_group(self, func):
     m = Mailupy('username', 'password', 'client-id', 'client-secret')
     assert m.create_group(1, 'TEST')['idGroup'] == 9
Beispiel #9
0
 def test_subscribe_to_list_pending(self, func):
     m = Mailupy('username', 'password', 'client-id', 'client-secret')
     assert m.subscribe_to_list(1,
                                'ASDFGHJKL',
                                '*****@*****.**',
                                pending=True) == 16
Beispiel #10
0
 def test_get_message_by_tags(self, func):
     m = Mailupy('username', 'password', 'client-id', 'client-secret')
     assert list(m.get_messages_from_list(1,
                                          ''))[0]['Subject'] == 'QWERTYUIOP'
Beispiel #11
0
 def test_send_message(self, func):
     m = Mailupy('username', 'password', 'client-id', 'client-secret')
     assert m.send_message('*****@*****.**', 1)
Beispiel #12
0
 def test_get_recipients_from_group(self, func):
     m = Mailupy('username', 'password', 'client-id', 'client-secret')
     assert list(m.get_recipients_from_group(6)) == []
Beispiel #13
0
 def test_get_recipients_from_list(self, func):
     m = Mailupy('username', 'password', 'client-id', 'client-secret')
     assert list(m.get_recipients_from_list(1))[0]['idRecipient'] == 13
Beispiel #14
0
 def test_get_groups_from_list(self, func):
     m = Mailupy('username', 'password', 'client-id', 'client-secret')
     assert list(m.get_groups_from_list(1))[0]['idGroup'] == 6
Beispiel #15
0
 def test_raise_exception_on_requests_exception(self, func):
     with self.assertRaises(MailupyException) as ex:
         m = Mailupy('username', 'password', 'client-id', 'client-secret')
         assert m.remove_from_list(1, 18)
Beispiel #16
0
 def test_send_message(self, func):
     m = Mailupy('username', 'password', 'client-id', 'client-secret')
     assert m.send_sms('+39','0000000000', 1)