Skip to content

Commit 99a6f77

Browse files
author
Arnaud Breton
committed
Populate data for tests before executing
1 parent 5c2b523 commit 99a6f77

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

test.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import unittest
22
from mailjet_rest import Client, __version__
33
import os
4-
4+
import random
5+
import string
56

67
class TestSuite(unittest.TestCase):
78

@@ -31,8 +32,13 @@ def test_get_with_data(self):
3132
self.failUnless(result.status_code == 200)
3233

3334
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})
37+
38+
self.failUnless(post_cl.status_code == 201)
3439
result_cl = self.client.contactslist.get(filters={'limit': 1}).json()
3540
self.failUnless(result_cl['Count'] > 0 )
41+
3642
result = self.client.contact_getcontactslists.get(result_cl['Data'][0]['ID']).json()
3743
self.failUnless('Count' in result)
3844

0 commit comments

Comments
 (0)