File tree Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -32,15 +32,18 @@ def test_get_with_data(self):
3232 self .failUnless (result .status_code == 200 )
3333
3434 def test_get_with_action (self ):
35- cl_random_name = '' .join (random .choice (string .ascii_uppercase + string .digits ) for _ in range (10 ))
36- post_cl = self .client .contactslist .create (data = {'Name' : cl_random_name })
35+ result_contact = self .client .contactslist .get (filters = {'limit' : 1 }).json ()
3736
38- self .failUnless (post_cl .status_code == 201 )
39- result_cl = self .client .contactslist .get (filters = {'limit' : 1 }).json ()
40- self .failUnless (result_cl ['Count' ] > 0 )
37+ if result_contact ['Count' ] is not 0 :
38+ contact_id = result_contact ['Data' ][0 ]['ID' ]
39+ else :
40+ contact_random_email = '' .join (random .choice (string .ascii_uppercase + string .digits ) for _ in range (10 )) + '@mailjet.com'
41+ post_contact = self .client .contact .create (data = {'Email' : contact_random_email })
42+ self .failUnless (post_contact .status_code == 201 )
43+ contact_id = post_contact .json ()['Data' ][0 ]['ID' ]
4144
42- result = self .client .contact_getcontactslists .get (result_cl [ 'Data' ][ 0 ][ 'ID' ] ).json ()
43- self .failUnless ('Count' in result )
45+ result = self .client .contact_getcontactslists .get (contact_id ).json ()
46+ self .failUnless (result [ 'Count' ] > 1 )
4447
4548 def test_get_with_id_filter (self ):
4649 result_contact = self .client .contact .get (filters = {'limit' : 1 }).json ()
You can’t perform that action at this time.
0 commit comments