Spaces:
Running
on
Zero
Running
on
Zero
File size: 971 Bytes
185f702 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
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) |