Skip to content

Commit 655ca82

Browse files
committed
Adjust tests
1 parent 8c4bca3 commit 655ca82

2 files changed

Lines changed: 36 additions & 15 deletions

File tree

tests/test_card.py

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22
Module: test_card
33
"""
44
import sys
5+
import unittest
6+
import mercadopago
7+
from datetime import datetime
8+
59
sys.path.append("../")
610

7-
from datetime import datetime #pylint: disable=wrong-import-position
8-
import unittest #pylint: disable=wrong-import-position
9-
import mercadopago #pylint: disable=wrong-import-position
1011

1112
class TestCard(unittest.TestCase):
1213
"""
@@ -19,6 +20,29 @@ def test_all(self):
1920
"""
2021
Test Function: Card
2122
"""
23+
customer_object = {
24+
"email": "test_payer_999940@testuser.com",
25+
"first_name": "Rafa",
26+
"last_name": "Williner",
27+
"phone": {
28+
"area_code": "03492",
29+
"number": "432334"
30+
},
31+
"identification": {
32+
"type": "DNI",
33+
"number": "29804555"
34+
},
35+
"address": {
36+
"zip_code": "47807078",
37+
"street_name": "some street",
38+
"street_number": 123
39+
},
40+
"description": "customer description"
41+
}
42+
43+
customer_created = self.sdk.customer().create(customer_object)
44+
customer_id = customer_created["response"]["id"]
45+
2246
card_token_object = {
2347
"card_number": "4074090000000004",
2448
"security_code": "123",
@@ -32,7 +56,6 @@ def test_all(self):
3256
}
3357
}
3458

35-
customer_id = "685810954-vbrXmBzkHl4UJ9"
3659
card_token_created = self.sdk.card_token().create(card_token_object)
3760

3861
card_object = {
@@ -42,16 +65,11 @@ def test_all(self):
4265

4366
card_created = self.sdk.card().create(customer_id, card_object)
4467
self.assertIn(card_created["status"], [200, 201])
45-
self.assertEqual(self.sdk.card()
46-
.get(customer_id, card_created["response"]["id"])["status"], 200)
68+
self.assertEqual(self.sdk.card().get(customer_id, card_created["response"]["id"])["status"], 200)
4769

4870
self.sdk.card().delete(customer_id, card_created["response"]["id"])
4971
self.sdk.customer().delete(customer_id)
5072

73+
5174
if __name__ == "__main__":
5275
unittest.main()
53-
54-
#try:
55-
# print(["id"])
56-
#except KeyError:
57-
# print("this param is unknown")

tests/test_customer.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22
Module: test_customer
33
"""
44
import sys
5+
import unittest
6+
import mercadopago
7+
58
sys.path.append("../")
69

7-
import unittest #pylint: disable=wrong-import-position
8-
import mercadopago #pylint: disable=wrong-import-position
910

1011
class TestCustomer(unittest.TestCase):
1112
"""
@@ -31,8 +32,9 @@ def test_all(self):
3132
"number": "29804555"
3233
},
3334
"address": {
34-
"zip_code": "2300",
35-
"street_name": "some street"
35+
"zip_code": "47807078",
36+
"street_name": "some street",
37+
"street_number": 123
3638
},
3739
"description": "customer description"
3840
}
@@ -50,5 +52,6 @@ def test_all(self):
5052
customer_deleted = self.sdk.customer().delete(customer_saved["response"]["id"])
5153
self.assertEqual(customer_deleted["status"], 200)
5254

55+
5356
if __name__ == "__main__":
5457
unittest.main()

0 commit comments

Comments
 (0)