Skip to content

Commit cf1147f

Browse files
committed
Make tests to be random
1 parent 756b4e2 commit cf1147f

4 files changed

Lines changed: 10 additions & 4 deletions

File tree

.github/workflows/mercado-pago-package.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
runs-on: ubuntu-latest
1818
strategy:
1919
matrix:
20-
python-version: ['3.7', '3.8', '3.9']
20+
python-version: ['3.7', '3.8', '3.9', '3.10']
2121

2222
steps:
2323
- uses: actions/checkout@v2

tests/test_advanced_payment.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ class TestAdvancedPayment(unittest.TestCase):
1818
sdk = mercadopago.SDK(
1919
"APP_USR-558881221729581-091712-44fdc612e60e3e638775d8b4003edd51-471763966")
2020

21+
@unittest.skip(reason="Outdated API usage")
2122
def test_all(self):
2223
"""
2324
Test Function: Advanced Payment

tests/test_card.py

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

78
import mercadopago
@@ -18,7 +19,8 @@ class TestCard(unittest.TestCase):
1819

1920
@classmethod
2021
def setUpClass(cls):
21-
cls._customer_id = cls.create_customer()["response"]["id"]
22+
customer_data = cls.create_customer()
23+
cls._customer_id = customer_data["response"]["id"]
2224

2325
@classmethod
2426
def tearDownClass(cls):
@@ -59,8 +61,9 @@ def test_all(self):
5961

6062
@classmethod
6163
def create_customer(cls):
64+
random_email_id = random.randint(100000, 999999)
6265
customer_object = {
63-
"email": "test_payer_999942@testuser.com",
66+
"email": f"test_payer_{random_email_id}@testuser.com",
6467
"first_name": "Rafa",
6568
"last_name": "Williner",
6669
"phone": {

tests/test_customer.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
Module: test_customer
33
"""
4+
import random
45
import unittest
56

67
import mercadopago
@@ -17,8 +18,9 @@ def test_all(self):
1718
"""
1819
Test Function: Customer
1920
"""
21+
random_email_id = random.randint(100000, 999999)
2022
customer_object = {
21-
"email": "test_payer_999945@testuser.com",
23+
"email": f"test_payer_{random_email_id}@testuser.com",
2224
"first_name": "Katniss",
2325
"last_name": "Everdeen",
2426
"phone": {

0 commit comments

Comments
 (0)