Skip to content

Instantly share code, notes, and snippets.

@jasongorman
Created December 12, 2019 12:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasongorman/5a0e711bbe6af66271098da2dfecba80 to your computer and use it in GitHub Desktop.
Save jasongorman/5a0e711bbe6af66271098da2dfecba80 to your computer and use it in GitHub Desktop.
class VideoInfoStub(VideoInfo):
def __init__(self, rating):
self.rating = rating
self.title = 'XXXXX'
def fetch_video_info(self, imdbID):
return self.rating, self.title
class RentalTest(unittest.TestCase):
def test_movie_title_retrieved(self):
rental = Rental('jgorman', 'tt9999', Pricer(VideoInfoStub(7.1)))
self.assertEqual('XXXXX', rental.video.title)
def test_customer_id_recorded(self):
rental = Rental('jgorman', 'tt9999', Pricer(VideoInfoStub(7.1)))
self.assertEqual('jgorman', rental.customer)
def test_high_rated_movie_price(self):
rental = Rental('jgorman', 'tt9999', Pricer(VideoInfoStub(7.1)))
self.assertEqual(4.95, rental.video.price)
def test_low_rated_movie_price(self):
rental = Rental('jgorman', 'tt9999', Pricer(VideoInfoStub(3.9)))
self.assertEqual(2.95, rental.video.price)
def test_medium_rated_movie_price(self):
rental = Rental('jgorman', 'tt9999', Pricer(VideoInfoStub(6.9)))
self.assertEqual(3.95, rental.video.price)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment