mirror of
https://github.com/cssgunc/compass.git
synced 2025-04-06 04:30:17 -04:00
Resolve pytest changes
This commit is contained in:
parent
a0d4074f44
commit
682d6b4e26
|
@ -1,21 +0,0 @@
|
|||
"""Sample Test File"""
|
||||
|
||||
from sqlalchemy import Engine, select
|
||||
|
||||
from ... import entities
|
||||
from ...entities.sample_entity import SampleEntity
|
||||
|
||||
|
||||
def test_entity_count():
|
||||
"""Checks the number of entities to be inserted"""
|
||||
print(entities.EntityBase.metadata.tables.keys())
|
||||
assert len(entities.EntityBase.metadata.tables.keys()) == 7
|
||||
|
||||
|
||||
def test_add_sample_data(session: Engine):
|
||||
"""Inserts a sample data point and verifies it is in the database"""
|
||||
entity = SampleEntity(name="Praj", age=19, email="pmoha@unc.edu")
|
||||
session.add(entity)
|
||||
session.commit()
|
||||
data = session.get(SampleEntity, 1)
|
||||
assert data.name == "Praj"
|
|
@ -31,7 +31,7 @@ def test_create_id_exists(user_svc: UserService):
|
|||
def test_get_all(user_svc: UserService):
|
||||
"""Test that all users can be retrieved."""
|
||||
users = user_svc.all()
|
||||
assert len(users) == 3
|
||||
assert len(users) == 4
|
||||
|
||||
|
||||
def test_get_user_by_id(user_svc: UserService):
|
||||
|
@ -56,12 +56,13 @@ def test_delete_user(user_svc: UserService):
|
|||
|
||||
def test_delete_user_nonexistent(user_svc: UserService):
|
||||
"""Test deleting a user that does not exist"""
|
||||
with pytest.raises(Exception):
|
||||
with pytest.raises(Exception):
|
||||
user_svc.delete(newUser)
|
||||
|
||||
def test_update_user(user_svc: UserService):
|
||||
|
||||
def test_update_user(user_svc: UserService):
|
||||
"""Test updating a user
|
||||
Updating volunteer
|
||||
Updating volunteer
|
||||
"""
|
||||
user = user_svc.get_user_by_id(volunteer.id)
|
||||
assert user is not None
|
||||
|
@ -73,10 +74,8 @@ def test_update_user(user_svc: UserService):
|
|||
assert updated_user.username == "volunteer 1"
|
||||
assert updated_user.email == "newemail@compass.com"
|
||||
|
||||
|
||||
def test_update_user_nonexistent(user_svc: UserService):
|
||||
""" Test updated a user that does not exist"""
|
||||
"""Test updated a user that does not exist"""
|
||||
with pytest.raises(Exception):
|
||||
user_svc.update(newUser)
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user