-
Notifications
You must be signed in to change notification settings - Fork 64
/
test_movie_post.py
64 lines (44 loc) · 1.91 KB
/
test_movie_post.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import requests
import json
def test_get_headers_movie():
url = "https://fynd-my-movie.herokuapp.com/movies"
payload={}
headers = {}
resp = requests.request("GET", url, headers=headers, data=payload)
assert resp.status_code == 200
def test_get_search_headers_movie():
url = "https://fynd-my-movie.herokuapp.com/movies?search=shutter"
payload={}
headers = {}
resp = requests.request("GET", url, headers=headers, data=payload)
assert resp.status_code == 200
def test_post_headers_movie():
url = "https://fynd-my-movie.herokuapp.com/movies"
token = "admin-login-token"
payload="{\n \"99popularity\": 92.0,\n \"director\": \"Stanley Kuberick\",\n \"genre\": [\n \"Sci-fy\",\n \"Drama\"\n ],\n \"imdb_score\": 9.5,\n \"name\": \"A.I\"\n}"
headers = {
'Authorization': 'Bearer '+token,
'Content-Type': 'application/json'
}
resp = requests.request("POST", url, headers=headers, data=payload)
assert resp.status_code == 200
def test_put_headers_movie():
url = "https://fynd-my-movie.herokuapp.com/movies/1"
token = "admin-login-token"
payload="{\n \"99popularity\": 84.0,\n \"director\": \"Victor Frank.\",\n \"genre\": [\n \"Adventure\",\n \" Family\",\n \" Fantasy\"\n ],\n \"imdb_score\": 8.3,\n \"name\": \"The Wizard of Oz\"\n}"
headers = {
'Authorization': 'Bearer '+token,
'Content-Type': 'application/json'
}
resp = requests.request("PUT", url, headers=headers, data=payload)
assert resp.status_code == 200
def test_delete_headers_movie():
url = "https://fynd-my-movie.herokuapp.com/movies/252"
token = "admin-login-token"
payload={}
headers = {
'Authorization': 'Bearer '+token,
'Content-Type': 'application/json'
}
resp = requests.request("DELETE", url, headers=headers, data=payload)
assert resp.status_code == 200