Skip to content

Commit 481d2cd

Browse files
authored
Merge pull request #75 from mercadopago/feature/adjusts_tests
Adjusts credential tests
2 parents e4a0271 + 4955574 commit 481d2cd

15 files changed

+43
-62
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
runs-on: ubuntu-latest
1515
strategy:
1616
matrix:
17-
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
17+
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12']
1818

1919
steps:
2020
- uses: actions/checkout@v2
@@ -42,3 +42,5 @@ jobs:
4242
- name: Test with unittest
4343
run: |
4444
python -m unittest discover tests/
45+
env:
46+
ACCESS_TOKEN: ${{secrets.ACCESS_TOKEN}}

tests/test_advanced_payment.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,17 @@
55
datetime,
66
timedelta,
77
)
8+
import os
89
import unittest
910
import uuid
10-
1111
import mercadopago
1212

1313

1414
class TestAdvancedPayment(unittest.TestCase):
1515
"""
1616
Test Module: Advanced Payment
1717
"""
18-
sdk = mercadopago.SDK(
19-
"APP_USR-558881221729581-091712-44fdc612e60e3e638775d8b4003edd51-471763966")
18+
sdk = mercadopago.SDK(os.environ['ACCESS_TOKEN'])
2019

2120
@unittest.skip(reason="Outdated API usage")
2221
def test_all(self):

tests/test_card.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
Module: test_card
33
"""
44
from datetime import datetime
5+
import os
56
import random
67
import unittest
7-
88
import mercadopago
99

1010

@@ -14,13 +14,11 @@ class TestCard(unittest.TestCase):
1414
"""
1515

1616
_customer_id = None
17-
sdk = mercadopago.SDK(
18-
"APP_USR-558881221729581-091712-44fdc612e60e3e638775d8b4003edd51-471763966")
17+
sdk = mercadopago.SDK(os.environ['ACCESS_TOKEN'])
1918

2019
@classmethod
2120
def setUpClass(cls):
2221
customer_data = cls.create_customer()
23-
print(customer_data)
2422
cls._customer_id = customer_data["response"]["id"]
2523

2624
@classmethod
@@ -46,7 +44,6 @@ def test_all(self):
4644
}
4745

4846
card_token_created = self.sdk.card_token().create(card_token_object)
49-
print(card_token_created)
5047

5148
card_object = {
5249
"customer_id": self._customer_id,
@@ -58,8 +55,7 @@ def test_all(self):
5855
self.assertEqual(self.sdk.card().get(
5956
self._customer_id, card_created["response"]["id"])["status"], 200)
6057

61-
self.sdk.card().delete(self._customer_id,
62-
card_created["response"]["id"])
58+
self.sdk.card().delete(self._customer_id, card_created["response"]["id"])
6359

6460
@classmethod
6561
def create_customer(cls):

tests/test_card_token.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,16 @@
22
Module: test_card_token
33
"""
44
from datetime import datetime
5+
import os
56
import unittest
6-
77
import mercadopago
88

99

1010
class TestCardToken(unittest.TestCase):
1111
"""
1212
Test Module: Card Token
1313
"""
14-
sdk = mercadopago.SDK(
15-
"APP_USR-558881221729581-091712-44fdc612e60e3e638775d8b4003edd51-471763966")
14+
sdk = mercadopago.SDK(os.environ['ACCESS_TOKEN'])
1615

1716
def test_all(self):
1817
"""

tests/test_chargeback.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
"""
22
Module: test_chargeback
33
"""
4+
import os
45
import unittest
5-
66
import mercadopago
77

88

99
class TestChargeback(unittest.TestCase):
1010
"""
1111
Test Module: Chargeback
1212
"""
13-
sdk = mercadopago.SDK(
14-
"APP_USR-558881221729581-091712-44fdc612e60e3e638775d8b4003edd51-471763966")
13+
sdk = mercadopago.SDK(os.environ['ACCESS_TOKEN'])
1514

1615
def test_search_chargeback(self):
1716
"""

tests/test_customer.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
"""
22
Module: test_customer
33
"""
4+
import os
45
import random
56
import unittest
6-
77
import mercadopago
88

99

1010
class TestCustomer(unittest.TestCase):
1111
"""
1212
Test Module: Customer
1313
"""
14-
sdk = mercadopago.SDK(
15-
"APP_USR-558881221729581-091712-44fdc612e60e3e638775d8b4003edd51-471763966")
14+
sdk = mercadopago.SDK(os.environ['ACCESS_TOKEN'])
1615

1716
def test_all(self):
1817
"""
@@ -41,12 +40,10 @@ def test_all(self):
4140
customer_saved["response"]["id"], {"last_name": "Payer"})
4241
self.assertEqual(200, customer_update["status"])
4342

44-
customer_updated = self.sdk.customer().get(
45-
customer_saved["response"]["id"])
43+
customer_updated = self.sdk.customer().get(customer_saved["response"]["id"])
4644
self.assertEqual(customer_updated["response"]["last_name"], "Payer")
4745

48-
customer_deleted = self.sdk.customer().delete(
49-
customer_saved["response"]["id"])
46+
customer_deleted = self.sdk.customer().delete(customer_saved["response"]["id"])
5047
self.assertEqual(200, customer_deleted["status"])
5148

5249

tests/test_identification_type.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
"""
22
Module: test_identification_type
33
"""
4+
import os
45
import unittest
5-
66
import mercadopago
77

88

99
class TestIdentificationType(unittest.TestCase):
1010
"""
1111
Test Module: Identification Type
1212
"""
13-
sdk = mercadopago.SDK(
14-
"APP_USR-558881221729581-091712-44fdc612e60e3e638775d8b4003edd51-471763966")
13+
sdk = mercadopago.SDK(os.environ['ACCESS_TOKEN'])
1514

1615
def test_find_all(self):
1716
"""

tests/test_merchant_order.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
"""
22
Module: test_merchant_order
33
"""
4+
import os
45
import unittest
56
import uuid
6-
77
import mercadopago
88

99

1010
class TestMerchantOrder(unittest.TestCase):
1111
"""
1212
Test Module: Merchant Order
1313
"""
14-
sdk = mercadopago.SDK(
15-
"APP_USR-558881221729581-091712-44fdc612e60e3e638775d8b4003edd51-471763966")
14+
sdk = mercadopago.SDK(os.environ['ACCESS_TOKEN'])
1615

1716
def test_all(self):
1817
"""

tests/test_payment.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,16 @@
22
Module: test_payment
33
"""
44
from datetime import datetime
5+
import os
56
import unittest
6-
77
import mercadopago
88

99

1010
class TestPayment(unittest.TestCase):
1111
"""
1212
Test Module: Payment
1313
"""
14-
sdk = mercadopago.SDK(
15-
"APP_USR-558881221729581-091712-44fdc612e60e3e638775d8b4003edd51-471763966")
14+
sdk = mercadopago.SDK(os.environ['ACCESS_TOKEN'])
1615

1716
def test_create_and_find(self):
1817
"""

tests/test_payment_methods.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
"""
22
Module: test_payment_methods
33
"""
4+
import os
45
import unittest
5-
66
import mercadopago
77

88

99
class TestPaymentMethods(unittest.TestCase):
1010
"""
1111
Test Module: Payment Methods
1212
"""
13-
sdk = mercadopago.SDK(
14-
"APP_USR-558881221729581-091712-44fdc612e60e3e638775d8b4003edd51-471763966")
13+
sdk = mercadopago.SDK(os.environ['ACCESS_TOKEN'])
1514

1615
def test_find(self):
1716
"""

0 commit comments

Comments
 (0)