Skip to content

Commit

Permalink
Adicao do teste da funcao de recomendacao a partir de video
Browse files Browse the repository at this point in the history
  • Loading branch information
Jauzimm committed Aug 23, 2024
1 parent dc512e1 commit d734a6a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/test_recomendation.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,15 @@ def mock_get_recommendations(video_id):
assert response.status_code == 200 # ok

assert response.json() == {"recommend_videos": [2, 1, 3, 4, 5]}

def test_get_recommendation_from_video():
# Patch para a função get_recommendations
with patch('pandas.read_csv', return_value=mock_df):
# Patch para a função open e o carregamento do pickle
with patch('builtins.open', mock_open(read_data=pickle.dumps(mock_cosine_sim))):
with patch('recommendation_model.get_video_recommendation.get_recommendations', return_value=mock_recommendations):
response = client.get("/api/recommendation/get_recommendation_video/?video_id=1")

assert response.status_code == 200 # ok

assert response.json() == {"recommend_videos": mock_recommendations}

0 comments on commit d734a6a

Please sign in to comment.