Spaces:
Running
on
Zero
Running
on
Zero
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', 'janedoe@example.com') | |
assert user.name == 'Jane Doe' | |
assert user.email == 'janedoe@example.com' | |
def test_mock_read_user(mock_crud): | |
user = mock_crud.create_user('Jane Doe', 'janedoe@example.com') | |
read_user = mock_crud.read_user(user.id) | |
assert read_user.name == 'Jane Doe' | |
assert read_user.email == 'janedoe@example.com' | |
def test_mock_update_user(mock_crud): | |
user = mock_crud.create_user('Jane Doe', 'janedoe@example.com') | |
updated_user = mock_crud.update_user(user.id, 'Jane Doe Updated', 'janedoeupdated@example.com') | |
assert updated_user.name == 'Jane Doe Updated' | |
assert updated_user.email == 'janedoeupdated@example.com' | |
def test_mock_delete_user(mock_crud): | |
user = mock_crud.create_user('Jane Doe', 'janedoe@example.com') | |
assert mock_crud.delete_user(user.id) |