Skip to content

Commit

Permalink
Resolvido problema no teste da remove
Browse files Browse the repository at this point in the history
  • Loading branch information
felipeJRdev committed Aug 5, 2024
1 parent 1851789 commit ba8161b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 19 deletions.
1 change: 1 addition & 0 deletions src/repository/savedVideosRepository.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ def check_favorite_status(db: Session, video_id: str, user_id: str) -> dict:
return {
"statusfavorite": False
}

def remove_favorite(db: Session, video_id: str, user_id: str):
video_id = video_id.strip()
user_id = user_id.strip()
Expand Down
18 changes: 1 addition & 17 deletions tests/junit.xml
Original file line number Diff line number Diff line change
@@ -1,17 +1 @@
<?xml version="1.0" encoding="utf-8"?><testsuites><testsuite name="pytest" errors="0" failures="1" skipped="0" tests="10" time="4.950" timestamp="2024-08-04T21:45:23.909118" hostname="5a0db4a21511"><testcase classname="test_favorite" name="test_add_to_favorite" time="0.111" /><testcase classname="test_favorite" name="test_check_favorite" time="0.017" /><testcase classname="test_favorite" name="test_remove_from_favorites" time="0.033"><failure message="assert True is False">setup_database = None

def test_remove_from_favorites(setup_database):
response = client.delete("/api/favorite/video123?user_id=user123")
print("Response from DELETE:", response.json())
assert response.status_code == 200
assert response.json()["message"] == "Removed from favorites"


# Check status again to ensure it's removed
response = client.get("/api/favorite/status/video123?user_id=user123")
print("Response from GET status:", response.json())
assert response.status_code == 200
&gt; assert response.json()["statusfavorite"] is False
E assert True is False

test_favorite.py:66: AssertionError</failure></testcase><testcase classname="test_schedule.TestSchedule" name="test_schedule_get_schedule_day" time="0.846" /><testcase classname="test_schedule.TestSchedule" name="test_schedule_get_schedule_specific_day_invalid" time="0.007" /><testcase classname="test_schedule.TestSchedule" name="test_schedule_get_schedule_specific_day" time="0.896" /><testcase classname="test_schedule.TestSchedule" name="test_schedule_get_schedule_day_exception_handling" time="0.011" /><testcase classname="test_watch_later" name="test_add_to_watch_later" time="0.021" /><testcase classname="test_watch_later" name="test_check_watch_later_status" time="0.017" /><testcase classname="test_watch_later" name="test_remove_from_watch_later" time="0.033" /></testsuite></testsuites>
<?xml version="1.0" encoding="utf-8"?><testsuites><testsuite name="pytest" errors="0" failures="0" skipped="0" tests="10" time="2.535" timestamp="2024-08-05T02:33:42.345505" hostname="eb7d7d6cc578"><testcase classname="test_favorite" name="test_add_to_favorite" time="0.044" /><testcase classname="test_favorite" name="test_check_favorite" time="0.007" /><testcase classname="test_favorite" name="test_remove_from_favorites" time="0.012" /><testcase classname="test_schedule.TestSchedule" name="test_schedule_get_schedule_day" time="0.842" /><testcase classname="test_schedule.TestSchedule" name="test_schedule_get_schedule_specific_day_invalid" time="0.003" /><testcase classname="test_schedule.TestSchedule" name="test_schedule_get_schedule_specific_day" time="0.562" /><testcase classname="test_schedule.TestSchedule" name="test_schedule_get_schedule_day_exception_handling" time="0.005" /><testcase classname="test_watch_later" name="test_add_to_watch_later" time="0.011" /><testcase classname="test_watch_later" name="test_check_watch_later_status" time="0.006" /><testcase classname="test_watch_later" name="test_remove_from_watch_later" time="0.012" /></testsuite></testsuites>
4 changes: 2 additions & 2 deletions tests/test_favorite.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def test_check_favorite(setup_database):
assert response.status_code == 200
assert response.json()["statusfavorite"] is True

"""def test_remove_from_favorites(setup_database):
def test_remove_from_favorites(setup_database):
response = client.delete("/api/favorite/video123?user_id=user123")
print("Response from DELETE:", response.json())
assert response.status_code == 200
Expand All @@ -63,4 +63,4 @@ def test_check_favorite(setup_database):
response = client.get("/api/favorite/status/video123?user_id=user123")
print("Response from GET status:", response.json())
assert response.status_code == 200
assert response.json()["statusfavorite"] is False"""
assert response.json()["statusfavorite"] is False

0 comments on commit ba8161b

Please sign in to comment.