Skip to content

Commit 54eef31

Browse files
FINISHED
1 parent b31f89a commit 54eef31

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

movieapp/models.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def get_last_request(self):
3838

3939
@property
4040
def poster_url(self):
41-
api_key = '5dbf33ab1210565bba9d880c176bf3d8'
41+
api_key = 'yourapi'
4242
base_url = f'https://api.themoviedb.org/3/movie/{self.tmdb_id}?api_key={api_key}'
4343

4444
try:

movieapp/tests.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ def test_create_request_as_anonymous_user(self):
2323
print('trying to make movie request as anonymous user, should be redirect to login page')
2424
self.client.logout()
2525
response = self.client.post(self.url)
26+
print(response)
2627
self.assertEqual(response.status_code, 302)
2728

2829
def test_create_request_success(self):
@@ -123,8 +124,8 @@ def test_poster_url(self, mock_get):
123124
mock_response = {
124125
'poster_path': '/testposter.jpg'
125126
}
126-
mock_get.return_value.json.return_value = mock_response
127-
127+
mock_get.return_value.json.return_value = mock_response # set return value of mock to mock_response
128+
print(mock_response)
128129
expected_url = 'https://image.tmdb.org/t/p/w342/testposter.jpg'
129130
self.assertEqual(self.movie.poster_url, expected_url)
130131

userdashboard/views.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def add_title(request):
8787
tmdb_id = request.POST.get('tmdb_id')
8888
if Movie.objects.filter(tmdb_id=tmdb_id).exists():
8989
return JsonResponse({'status': 'This title already exists in the catalog'})
90-
api_key = '5dbf33ab1210565bba9d880c176bf3d8'
90+
api_key = 'yourapi'
9191
movie_info = movie_search_API.get_movie_details(tmdb_id, api_key)
9292
if movie_info is not None:
9393
new_movie = Movie(tmdb_id=tmdb_id,

utils/TMDB_scraper.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import random
33
import json
44

5-
API_KEY = '5dbf33ab1210565bba9d880c176bf3d8'
5+
API_KEY = 'yourapi'
66

77

88
def get_random_movies(num_movies=30):

0 commit comments

Comments
 (0)