예제 #1
0
 def test_delete(self, *args):
     """
     Test DELETE request.
     """
     response = movies.MoviesAPI().delete()
     self.assertIn(str(errors.MethodNotImplementedException.SUBCODE),
                   str(response))
예제 #2
0
 def test_put(self, *args):
     """
     Test PUT request.
     """
     response = movies.MoviesAPI().put()
     self.assertIn(str(errors.MethodNotImplementedException.SUBCODE),
                   str(response))
예제 #3
0
 def test_get_bad_page(self, *args):
     """
     Test GET request with bad page.
     """
     with patch.object(movies.movies.MoviesController, "search") as mock:
         mock.side_effect = movies.movies.PageException
         response = movies.MoviesAPI().get()
         self.assertIn(str(errors.PageFormException.SUBCODE), str(response))
예제 #4
0
 def test_post_bad_released_at(self, *args):
     """
     Test POST request with bad first name.
     """
     with patch.object(movies.movies.MoviesController, "create") as mock:
         mock.side_effect = movies.movies.TitleException
         response = movies.MoviesAPI().post()
         self.assertIn(str(errors.TitleFormException.SUBCODE),
                       str(response))
예제 #5
0
 def test_post(self, *args):
     """
     Test POST request.
     """
     response = movies.MoviesAPI().post()
     self.assertIsInstance(response, dict)
     self.assertIn(constants.Movie.SINGULAR, response)
     self.assertTrue(response[constants.Movie.SINGULAR].released_at)
     self.assertTrue(response[constants.Movie.SINGULAR].title)
     self.assertTrue(response[constants.Movie.SINGULAR].created_at)
예제 #6
0
 def test_get(self, *args):
     """
     Test GET request.
     """
     response = movies.MoviesAPI().get()
     self.assertIsInstance(response, dict)
     self.assertIn(constants.Movie.PLURAL, response)
     self.assertTrue(response[constants.Movie.PLURAL][0].released_at)
     self.assertTrue(response[constants.Movie.PLURAL][1].title)
     self.assertTrue(response[constants.Movie.PLURAL][2].created_at)