Created
December 12, 2019 12:06
-
-
Save jasongorman/5a0e711bbe6af66271098da2dfecba80 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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