Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
mhsr21 committed May 6, 2024
1 parent 58b980a commit 1ec5c81
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions movie-backend/test_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def test_search_tv_shows(self):
def test_rate_movie_success(self):
"""Test rate_movie()"""
response = self.app.post('/movie/12/rate', json={
"value" : 5
"value" : 10
})
self.assertEqual(response.status_code, 200)
self.assertTrue(response.json['success'])
Expand All @@ -63,7 +63,7 @@ def test_rate_movie_fail(self):
def test_rate_tv_show_success(self):
"""Test rate_tv_show()"""
response = self.app.post('/movie/1396/rate', json={
"value" : 5
"value" : 10
})
self.assertEqual(response.status_code, 200)
self.assertTrue(response.json['success'])
Expand All @@ -75,6 +75,18 @@ def test_rate_tv_show_fail(self):
})
self.assertEqual(response.status_code, 400)
self.assertIn("error", response.json)

def test_get_rated_movies(self):
"""Test get_rated_movies()"""
response = self.app.get('/rated/movies')
self.assertEqual(response.status_code, 200)
self.assertIn('total_results', response.json)

def test_get_rated_tv_shows(self):
"""Test get_rated_tv_shwos()"""
response = self.app.get('/rated/tv')
self.assertEqual(response.status_code, 200)
self.assertIn('total_results', response.json)

if __name__ == '__main__':
unittest.main()

0 comments on commit 1ec5c81

Please sign in to comment.