Skip to content

Commit ceb0d8c

Browse files
Refactor
1 parent 3f6c7a2 commit ceb0d8c

File tree

7 files changed

+12
-88
lines changed

7 files changed

+12
-88
lines changed

pyproject.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ python-dotenv = "^1.0.1"
1717
pytest = "^8.2.2"
1818
pytest-mock = "^3.14.0"
1919

20-
[tool.pytest.ini_options]
21-
addopts = [
22-
"--dburl=postgresql://myuser:mypassword@localhost:5433/mydatabase_test",
23-
"-v",
24-
"-s",
25-
]
20+
# [tool.pytest.ini_options]
21+
# addopts = [
22+
# # "--dburl=postgresql://myuser:mypassword@localhost:5433/mydatabase_test",
23+
# "-v",
24+
# "-s",
25+
# ]
2626

2727
[build-system]
2828
requires = ["poetry-core"]

tests/conftest.py

Lines changed: 0 additions & 75 deletions
This file was deleted.

user_manager/app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import os
22
from flask import Flask, jsonify, request
33
from dotenv import load_dotenv
4-
from .models import db, User
4+
from models import db, User
55

66

77
def create_app(app_config=None):
File renamed without changes.

tests/mocking/conftest.py renamed to user_manager/tests/mocking/conftest.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import pytest
22
import random
3-
from user_manager.app import create_app
4-
from user_manager.models import db
3+
from app import create_app
54

65

76
@pytest.fixture(scope="session")

tests/mocking/test_user_manager_mocked.py renamed to user_manager/tests/mocking/test_user_manager_mocked.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import json
2-
from user_manager.models import User
2+
from models import User
33

44

55
def test_add_user(test_client, user_payload, mocker):
66
# Mock the add and commit operations
7-
mock_session_add = mocker.patch("user_manager.app.db.session.add", autospec=True)
7+
mock_session_add = mocker.patch("app.db.session.add", autospec=True)
88
mock_session_commit = mocker.patch(
9-
"user_manager.app.db.session.commit", autospec=True
9+
"app.db.session.commit", autospec=True
1010
)
1111

1212
# Simulate the POST request to add a user
@@ -22,7 +22,7 @@ def test_add_user(test_client, user_payload, mocker):
2222
mock_session_commit.assert_called_once()
2323

2424
# Mock User.query to return a list containing a new User instance
25-
mock_user_query = mocker.patch("user_manager.app.User.query")
25+
mock_user_query = mocker.patch("app.User.query")
2626
expected_user_object = User(
2727
username=user_payload["username"], email=user_payload["email"]
2828
)
File renamed without changes.

0 commit comments

Comments
 (0)