-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
12 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,8 +9,8 @@ | |
# Mock Models | ||
user = User(id=1, pid=111111111, onyen='onyen',first_name="first", last_name = "last", email='[email protected]', pronouns="He/Him/His", permissions = []) | ||
|
||
post_0 = Post(id = 1, content = "post", user = user, votes = [], timestamp = "date0") | ||
post_1 = Post(id = 2, content = "content", user = user, votes = [], timestamp = "date1") | ||
post_0 = Post(id = 1, title = "title", content = "post", user = user, votes = [], timestamp = "date0") | ||
post_1 = Post(id = 2, title = "title", content = "content", user = user, votes = [], timestamp = "date1") | ||
|
||
@pytest.fixture(autouse=True) | ||
def setup_teardown(test_session: Session): | ||
|
@@ -46,5 +46,13 @@ def test_getall_posts_pass(postservice: PostService, userservice: UserService): | |
post_entity_0: Post = postservice.create(post_0, user_entity) | ||
post_entity_1: Post = postservice.create(post_1, user_entity) | ||
posts = postservice.getAll() | ||
assert posts[0] == post_0 | ||
assert posts[1] == post_1 | ||
assert posts[0] == post_entity_0 | ||
assert posts[1] == post_entity_1 | ||
|
||
def test_delete_post_pass(postservice: PostService, userservice: UserService): | ||
user_entity: UserEntity = userservice.findUser(user) | ||
post_entity_0: Post = postservice.create(post_0, user_entity) | ||
post_entity_1: Post = postservice.create(post_1, user_entity) | ||
postservice.delete(post_entity_0.id) | ||
posts = postservice.getAll() | ||
assert posts[0] == post_entity_1 |