-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
482 additions
and
539 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,173 +22,193 @@ | |
} | ||
}, | ||
"balance": { | ||
"[email protected]": 653, | ||
"[email protected]": 253, | ||
"[email protected]": 200, | ||
"[email protected]": 500 | ||
"[email protected]": "658", | ||
"[email protected]": "258", | ||
"[email protected]": "205", | ||
"[email protected]": "505" | ||
}, | ||
"movement": { | ||
"[email protected]": [ | ||
{ | ||
"date": "2024-06-30T13:17:00.085814", | ||
"actor": "system", | ||
"value": 500 | ||
"value": "500", | ||
"date": "2024-06-30T13:17:00.085814" | ||
}, | ||
{ | ||
"date": "2024-07-01T09:38:03.015041", | ||
"actor": "solermvictor", | ||
"value": 30 | ||
"value": "30", | ||
"date": "2024-07-01T09:38:03.015041" | ||
}, | ||
{ | ||
"date": "2024-07-01T09:38:15.965008", | ||
"actor": "solermvictor", | ||
"value": 332 | ||
"value": "332", | ||
"date": "2024-07-01T09:38:15.965008" | ||
}, | ||
{ | ||
"date": "2024-07-01T09:43:45.392936", | ||
"actor": "solermvictor", | ||
"value": -62 | ||
"value": "-62", | ||
"date": "2024-07-01T09:43:45.392936" | ||
}, | ||
{ | ||
"date": "2024-07-01T09:45:45.790470", | ||
"actor": "solermvictor", | ||
"value": 62 | ||
"value": "62", | ||
"date": "2024-07-01T09:45:45.790470" | ||
}, | ||
{ | ||
"date": "2024-07-01T09:45:52.961517", | ||
"actor": "solermvictor", | ||
"value": -62 | ||
"value": "-62", | ||
"date": "2024-07-01T09:45:52.961517" | ||
}, | ||
{ | ||
"date": "2024-07-01T09:47:39.710349", | ||
"actor": "solermvictor", | ||
"value": 5 | ||
"value": "5", | ||
"date": "2024-07-01T09:47:39.710349" | ||
}, | ||
{ | ||
"date": "2024-07-01T09:47:47.852407", | ||
"actor": "solermvictor", | ||
"value": 5 | ||
"value": "5", | ||
"date": "2024-07-01T09:47:47.852407" | ||
}, | ||
{ | ||
"date": "2024-07-01T10:28:44.587618", | ||
"actor": "solermvictor", | ||
"value": -257 | ||
"value": "-257", | ||
"date": "2024-07-01T10:28:44.587618" | ||
}, | ||
{ | ||
"date": "2024-07-01T10:29:00.532653", | ||
"actor": "solermvictor", | ||
"value": 100 | ||
"value": "100", | ||
"date": "2024-07-01T10:29:00.532653" | ||
}, | ||
{ | ||
"date": "2024-07-19T14:41:20.573189", | ||
"actor": "solermvictor", | ||
"value": 5 | ||
"value": "5", | ||
"date": "2024-07-19T14:41:20.573189" | ||
}, | ||
{ | ||
"date": "2024-07-19T14:42:12.498918", | ||
"actor": "solermvictor", | ||
"value": -5 | ||
"value": "-5", | ||
"date": "2024-07-19T14:42:12.498918" | ||
}, | ||
{ | ||
"actor": "solermvictor", | ||
"value": "5", | ||
"date": "2024-07-22T09:53:14.006612" | ||
} | ||
], | ||
"[email protected]": [ | ||
{ | ||
"date": "2024-06-30T13:17:00.086117", | ||
"actor": "system", | ||
"value": 100 | ||
"value": "100", | ||
"date": "2024-06-30T13:17:00.086117" | ||
}, | ||
{ | ||
"actor": "solermvictor", | ||
"value": "30", | ||
"date": "2024-07-01T09:38:03.015054" | ||
}, | ||
{ | ||
"date": "2024-07-01T09:38:03.015054", | ||
"actor": "solermvictor", | ||
"value": 30 | ||
"value": "332", | ||
"date": "2024-07-01T09:38:15.965025" | ||
}, | ||
{ | ||
"date": "2024-07-01T09:38:15.965025", | ||
"actor": "solermvictor", | ||
"value": 332 | ||
"value": "-62", | ||
"date": "2024-07-01T09:43:45.392949" | ||
}, | ||
{ | ||
"date": "2024-07-01T09:43:45.392949", | ||
"actor": "solermvictor", | ||
"value": -62 | ||
"value": "62", | ||
"date": "2024-07-01T09:45:45.790483" | ||
}, | ||
{ | ||
"date": "2024-07-01T09:45:45.790483", | ||
"actor": "solermvictor", | ||
"value": 62 | ||
"value": "-62", | ||
"date": "2024-07-01T09:45:52.961531" | ||
}, | ||
{ | ||
"date": "2024-07-01T09:45:52.961531", | ||
"actor": "solermvictor", | ||
"value": -62 | ||
"value": "5", | ||
"date": "2024-07-01T09:47:39.710364" | ||
}, | ||
{ | ||
"date": "2024-07-01T09:47:39.710364", | ||
"actor": "solermvictor", | ||
"value": 5 | ||
"value": "5", | ||
"date": "2024-07-01T09:47:47.852421" | ||
}, | ||
{ | ||
"date": "2024-07-01T09:47:47.852421", | ||
"actor": "solermvictor", | ||
"value": 5 | ||
"value": "-257", | ||
"date": "2024-07-01T10:28:44.587632" | ||
}, | ||
{ | ||
"date": "2024-07-01T10:28:44.587632", | ||
"actor": "solermvictor", | ||
"value": -257 | ||
"value": "100", | ||
"date": "2024-07-01T10:29:00.532668" | ||
}, | ||
{ | ||
"date": "2024-07-01T10:29:00.532668", | ||
"actor": "solermvictor", | ||
"value": 100 | ||
"value": "5", | ||
"date": "2024-07-19T14:41:20.573205" | ||
}, | ||
{ | ||
"date": "2024-07-19T14:41:20.573205", | ||
"actor": "solermvictor", | ||
"value": 5 | ||
"value": "-5", | ||
"date": "2024-07-19T14:42:12.498933" | ||
}, | ||
{ | ||
"date": "2024-07-19T14:42:12.498933", | ||
"actor": "solermvictor", | ||
"value": -5 | ||
"value": "5", | ||
"date": "2024-07-22T09:53:14.006660" | ||
} | ||
], | ||
"[email protected]": [ | ||
{ | ||
"date": "2024-06-30T13:17:00.086294", | ||
"actor": "system", | ||
"value": 100 | ||
"value": "100", | ||
"date": "2024-06-30T13:17:00.086294" | ||
}, | ||
{ | ||
"date": "2024-07-01T10:28:22.353956", | ||
"actor": "solermvictor", | ||
"value": 100 | ||
"value": "100", | ||
"date": "2024-07-01T10:28:22.353956" | ||
}, | ||
{ | ||
"date": "2024-07-19T14:41:20.573209", | ||
"actor": "solermvictor", | ||
"value": 5 | ||
"value": "5", | ||
"date": "2024-07-19T14:41:20.573209" | ||
}, | ||
{ | ||
"date": "2024-07-19T14:42:12.498938", | ||
"actor": "solermvictor", | ||
"value": -5 | ||
"value": "-5", | ||
"date": "2024-07-19T14:42:12.498938" | ||
}, | ||
{ | ||
"actor": "solermvictor", | ||
"value": "5", | ||
"date": "2024-07-22T09:53:14.006692" | ||
} | ||
], | ||
"[email protected]": [ | ||
{ | ||
"date": "2024-07-15T18:20:06.454769", | ||
"actor": "system", | ||
"value": 500 | ||
"value": "500", | ||
"date": "2024-07-15T18:20:06.454769" | ||
}, | ||
{ | ||
"actor": "solermvictor", | ||
"value": "5", | ||
"date": "2024-07-19T14:41:20.573212" | ||
}, | ||
{ | ||
"date": "2024-07-19T14:41:20.573212", | ||
"actor": "solermvictor", | ||
"value": 5 | ||
"value": "-5", | ||
"date": "2024-07-19T14:42:12.498940" | ||
}, | ||
{ | ||
"date": "2024-07-19T14:42:12.498940", | ||
"actor": "solermvictor", | ||
"value": -5 | ||
"value": "5", | ||
"date": "2024-07-22T09:53:14.006720" | ||
} | ||
] | ||
}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,43 @@ | ||
"""Configuration of Pytest for the tests of dundie functions.""" | ||
|
||
import warnings | ||
import pytest | ||
from unittest.mock import patch | ||
from sqlmodel import create_engine | ||
from dundie import models | ||
from sqlalchemy.exc import SAWarning | ||
|
||
|
||
warnings.filterwarnings("ignore", category=SAWarning) | ||
|
||
|
||
MARKER = """\ | ||
unit: Mark unit tests | ||
integration: Mark integration tests | ||
high: High priority | ||
medium: Medium priority | ||
low: Low priority | ||
high: High Priority | ||
medium: Medium Priority | ||
low: Low Priority | ||
""" | ||
|
||
|
||
def pytest_configure(config): | ||
"""Configure the marker for functions.""" | ||
for line in MARKER.split("\n"): | ||
config.addinivalue_line("markers", line) | ||
|
||
|
||
@pytest.fixture(autouse=True) | ||
def go_to_tmpdir(request): # injeção de dependencias | ||
"""Configure to tests run in temporary directory.""" | ||
tmpdir = request.getfixturevalue("tmpdir") | ||
with tmpdir.as_cwd(): | ||
yield # protocolo de generators | ||
|
||
|
||
@pytest.fixture(autouse=True, scope="function") | ||
def setup_testing_database(request): | ||
"""For each test, create a db on tmpdir forcing to use that filepath.""" | ||
"""For each test, create a database file on tmpdir | ||
force database.py to use that filepath. | ||
""" | ||
tmpdir = request.getfixturevalue("tmpdir") | ||
test_db = str(tmpdir.join("database.test.json")) | ||
with patch("dundie.database.DATABASE_PATH", test_db): | ||
test_db = str(tmpdir.join("database.test.db")) | ||
engine = create_engine(f"sqlite:///{test_db}") | ||
models.SQLModel.metadata.create_all(bind=engine) | ||
with patch("dundie.database.engine", engine): | ||
yield |
Oops, something went wrong.