-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
48 lines (39 loc) · 1.54 KB
/
Copy pathtest.py
File metadata and controls
48 lines (39 loc) · 1.54 KB
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
import requests
import unittest
class TestNetflixShowsAPI(unittest.TestCase):
def test_upper(self):
self.assertEqual('foo'.upper(), 'FOO')
def test_view_all_shows(self):
response = requests.get('http://127.0.0.1:5000/viewAllShows?limit=5&offset=1&sortBy=ASC')
actual_length = len(response.json())
expected_length = 5
self.assertEqual(actual_length, expected_length)
def test_create_new_show(self):
url = "http://127.0.0.1:5000/insertShow"
data = {"show_id": 11229988,
"type": "Movie",
"title": "Test1",
"director": "Test1",
"cast": "Test1",
"country": "Test1",
"date_added": "2021-02-08",
"release_year": 2021,
"rating": "PG",
"duration": "Test1",
"listed_in": "Test1",
"description": "Test1"}
response = requests.post(url, data=data)
self.assertEqual(response.status_code,201)
def test_modify_show(self):
url = "http://127.0.0.1:5000/updateShowType"
data = {"show_id": 11229988,
"show_type": "TV Show"}
response = requests.put(url, data=data)
self.assertEqual(response.status_code, 201)
def test_delete_show(self):
url = "http://127.0.0.1:5000/deleteShowById"
data = {"show_id": 11229988}
response = requests.delete(url, data=data)
self.assertEqual(response.status_code, 201)
if __name__ == '__main__':
unittest.main()