Skip to content

Commit

Permalink
init tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fvergaracl committed Feb 7, 2024
1 parent 79437a9 commit ba9ca6f
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 169 deletions.
81 changes: 0 additions & 81 deletions tests/conftest.py

This file was deleted.

24 changes: 0 additions & 24 deletions tests/integration_tests/test_auth_router.py

This file was deleted.

4 changes: 0 additions & 4 deletions tests/integration_tests/test_client.py

This file was deleted.

20 changes: 0 additions & 20 deletions tests/test_data/posts.json

This file was deleted.

26 changes: 0 additions & 26 deletions tests/test_data/users.json

This file was deleted.

54 changes: 54 additions & 0 deletions tests/unit_tests/model/base_model.test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import pytest
from uuid import UUID
# Asegúrate de importar correctamente tu clase BaseModel
from app.model.base_model import BaseModel


def test_base_model_instantiation():
model_instance = BaseModel()
assert isinstance(model_instance.id, UUID)
assert model_instance.created_at is not None
assert model_instance.updated_at is not None


def test_base_model_equality():
model_instance1 = BaseModel()
model_instance2 = BaseModel()
assert model_instance1 != model_instance2

# Simular que model_instance2 es igual a model_instance1
model_instance2.id = model_instance1.id
model_instance2.created_at = model_instance1.created_at
model_instance2.updated_at = model_instance1.updated_at
assert model_instance1 == model_instance2


def test_base_model_ordering():
model_instance1 = BaseModel()
model_instance2 = BaseModel()
assert model_instance1 != model_instance2
assert (model_instance1 < model_instance2) or (
model_instance1 > model_instance2)


def test_base_model_representation():
model_instance = BaseModel()
str_representation = (
f"BaseModel: {model_instance.id}, {model_instance.created_at}, "
"{model_instance.updated_at}"
)
assert str(model_instance) == str_representation
assert repr(model_instance) == str_representation


def test_base_model_hash():
model_instance = BaseModel()
assert isinstance(hash(model_instance), int)


@pytest.mark.parametrize("model_instance1,model_instance2,expected", [
(BaseModel(), BaseModel(), False),
(BaseModel(), "not_a_model_instance", False),
])
def test_base_model_inequality(model_instance1, model_instance2, expected):
assert (model_instance1 != model_instance2) is expected
12 changes: 0 additions & 12 deletions tests/unit_tests/test_container.py

This file was deleted.

2 changes: 0 additions & 2 deletions tests/unit_tests/test_fixture.py

This file was deleted.

0 comments on commit ba9ca6f

Please sign in to comment.