@@ -16,21 +16,21 @@ def setUp(self):
1616
1717 def test_get_no_param (self ):
1818 result = self .client .contact .get ().json ()
19- self .failUnless (('Data' in result and 'Count' in result ))
19+ self .assertTrue (('Data' in result and 'Count' in result ))
2020
2121 def test_get_valid_params (self ):
2222 result = self .client .contact .get (filters = {'limit' : 2 }).json ()
23- self .failUnless ( 'Count' >= 0 or result ['Count' ] <= 2 )
23+ self .assertTrue ( result [ 'Count' ] >= 0 or result ['Count' ] <= 2 )
2424
2525 def test_get_invalid_parameters (self ):
2626 # invalid parameters are ignored
2727 result = self .client .contact .get (filters = {'invalid' : 'false' }).json ()
28- self .failUnless ('Count' in result )
28+ self .assertTrue ('Count' in result )
2929
3030 def test_get_with_data (self ):
3131 # it shouldn't use data
3232 result = self .
client .
contact .
get (
data = {
'Email' :
'[email protected] ' })
33- self .failUnless (result .status_code == 200 )
33+ self .assertTrue (result .status_code == 200 )
3434
3535 def test_get_with_action (self ):
3636 get_contact = self .client .contact .get (filters = {'limit' : 1 }).json ()
@@ -39,7 +39,7 @@ def test_get_with_action(self):
3939 else :
4040 contact_random_email = '' .join (random .choice (string .ascii_uppercase + string .digits ) for _ in range (10 )) + '@mailjet.com'
4141 post_contact = self .client .contact .create (data = {'Email' : contact_random_email })
42- self .failUnless (post_contact .status_code == 201 )
42+ self .assertTrue (post_contact .status_code == 201 )
4343 contact_id = post_contact .json ()['Data' ][0 ]['ID' ]
4444
4545 get_contact_list = self .client .contactslist .get (filters = {'limit' : 1 }).json ()
@@ -48,7 +48,7 @@ def test_get_with_action(self):
4848 else :
4949 contact_list_random_name = '' .join (random .choice (string .ascii_uppercase + string .digits ) for _ in range (10 )) + '@mailjet.com'
5050 post_contact_list = self .client .contactslist .create (data = {'Name' : contact_list_random_name })
51- self .failUnless (post_contact_list .status_code == 201 )
51+ self .assertTrue (post_contact_list .status_code == 201 )
5252 list_id = post_contact_list .json ()['Data' ][0 ]['ID' ]
5353
5454 data = {
@@ -60,19 +60,19 @@ def test_get_with_action(self):
6060 ]
6161 }
6262 result_add_list = self .client .contact_managecontactslists .create (id = contact_id , data = data )
63- self .failUnless (result_add_list .status_code == 201 )
63+ self .assertTrue (result_add_list .status_code == 201 )
6464
6565 result = self .client .contact_getcontactslists .get (contact_id ).json ()
66- self .failUnless ('Count' in result )
66+ self .assertTrue ('Count' in result )
6767
6868 def test_get_with_id_filter (self ):
6969 result_contact = self .client .contact .get (filters = {'limit' : 1 }).json ()
7070 result_contact_with_id = self .client .contact .get (filter = {'Email' : result_contact ['Data' ][0 ]['Email' ]}).json ()
71- self .failUnless (result_contact_with_id ['Data' ][0 ]['Email' ] == result_contact ['Data' ][0 ]['Email' ])
71+ self .assertTrue (result_contact_with_id ['Data' ][0 ]['Email' ] == result_contact ['Data' ][0 ]['Email' ])
7272
7373 def test_post_with_no_param (self ):
7474 result = self .client .sender .create (data = {}).json ()
75- self .failUnless ('StatusCode' in result and result ['StatusCode' ] is not 400 )
75+ self .assertTrue ('StatusCode' in result and result ['StatusCode' ] is not 400 )
7676
7777 def test_client_custom_version (self ):
7878 self .client = Client (
0 commit comments