File tree 4 files changed +6
-5
lines changed
4 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ def get_last_request(self):
38
38
39
39
@property
40
40
def poster_url (self ):
41
- api_key = '5dbf33ab1210565bba9d880c176bf3d8 '
41
+ api_key = 'yourapi '
42
42
base_url = f'https://api.themoviedb.org/3/movie/{ self .tmdb_id } ?api_key={ api_key } '
43
43
44
44
try :
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ def test_create_request_as_anonymous_user(self):
23
23
print ('trying to make movie request as anonymous user, should be redirect to login page' )
24
24
self .client .logout ()
25
25
response = self .client .post (self .url )
26
+ print (response )
26
27
self .assertEqual (response .status_code , 302 )
27
28
28
29
def test_create_request_success (self ):
@@ -123,8 +124,8 @@ def test_poster_url(self, mock_get):
123
124
mock_response = {
124
125
'poster_path' : '/testposter.jpg'
125
126
}
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 )
128
129
expected_url = 'https://image.tmdb.org/t/p/w342/testposter.jpg'
129
130
self .assertEqual (self .movie .poster_url , expected_url )
130
131
Original file line number Diff line number Diff line change @@ -87,7 +87,7 @@ def add_title(request):
87
87
tmdb_id = request .POST .get ('tmdb_id' )
88
88
if Movie .objects .filter (tmdb_id = tmdb_id ).exists ():
89
89
return JsonResponse ({'status' : 'This title already exists in the catalog' })
90
- api_key = '5dbf33ab1210565bba9d880c176bf3d8 '
90
+ api_key = 'yourapi '
91
91
movie_info = movie_search_API .get_movie_details (tmdb_id , api_key )
92
92
if movie_info is not None :
93
93
new_movie = Movie (tmdb_id = tmdb_id ,
Original file line number Diff line number Diff line change 2
2
import random
3
3
import json
4
4
5
- API_KEY = '5dbf33ab1210565bba9d880c176bf3d8 '
5
+ API_KEY = 'yourapi '
6
6
7
7
8
8
def get_random_movies (num_movies = 30 ):
You can’t perform that action at this time.
0 commit comments