kenken999's picture
sd
185f702
raw
history blame
971 Bytes
import pytest
from app.crud import CRUD
from .conftest import mock_crud
def test_mock_create_user(mock_crud):
user = mock_crud.create_user('Jane Doe', '[email protected]')
assert user.name == 'Jane Doe'
assert user.email == '[email protected]'
def test_mock_read_user(mock_crud):
user = mock_crud.create_user('Jane Doe', '[email protected]')
read_user = mock_crud.read_user(user.id)
assert read_user.name == 'Jane Doe'
assert read_user.email == '[email protected]'
def test_mock_update_user(mock_crud):
user = mock_crud.create_user('Jane Doe', '[email protected]')
updated_user = mock_crud.update_user(user.id, 'Jane Doe Updated', '[email protected]')
assert updated_user.name == 'Jane Doe Updated'
assert updated_user.email == '[email protected]'
def test_mock_delete_user(mock_crud):
user = mock_crud.create_user('Jane Doe', '[email protected]')
assert mock_crud.delete_user(user.id)