Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 0 additions & 57 deletions .github/workflows/sonar.yml

This file was deleted.

30 changes: 30 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: 1 Tests

on:
pull_request:
types: ["opened", "edited", "reopened", "synchronize", "ready_for_review"]

jobs:
tests:
if: (! github.event.pull_request.draft) && github.head_ref != 'main' && github.head_ref != 'develop'

runs-on: ubuntu-latest

steps:
- name: Checkout do código
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Instalar dependências
run: |
python -m pip install --upgrade pip
pip install -r requirements/dev.txt
pip install -r requirements/test.txt

- name: Rodar testes
run: |
pytest
4 changes: 2 additions & 2 deletions creditcard/card.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,21 @@
"codensa": r"^(870055|590712|529448)[0-9]{10}$",
"master": (
r"^"
r"(5[1-5][0-9]{14}"
r"(5[0-9]{15}"
r"|2221[0-9]{12}"
r"|222[2-9][0-9]{12}"
r"|22[3-9][0-9]{13}"
r"|2[3-6][0-9]{14}"
r"|27[01][0-9]{13}"
r"|2720[0-9]{12}"
# Suporte aos antigos cartões Maestro que agora são MasterCard
r"|5[06789][0-9]{14}"
r"|600[689][0-9]{12}"
r"|602[468][0-9]{12}"
r"|603[0-9]{13}"
r"|604[69][0-9]{12}"
r"|605[045][0-9]{12}"
r"|606[234][0-9]{12}"
r"|6087[0-9]{12}"
r"|6095[0-9]{12}"
r"|6220[0-9]{12}"
r"|627[389][0-9]{12}"
Expand Down
3 changes: 3 additions & 0 deletions tests/unit/test_card.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ def test_is_valid(self):
("master", "6039137880232543"), # antigo maestro
("master", "6063216106123345"), # antigo maestro
("master", "6392403325708112"), # antigo maestro
("master", "6087101111111111"),
("master", "6087831111111111"),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Porque dois testes para o mesmo pattern?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

O mesmo pattern contempla esses dois BINs que tavam dando bastante erro, então deixei no teste para garantir que nenhuma mudança vai fazer voltar o bug.

("master", "5502091111111111"),
("codensa", "8700551111111111"),
("codensa", "5907121111111111"),
("codensa", "5294481111111111"),
Expand Down
Loading