Skip to content

Instantly share code, notes, and snippets.

@jasongorman
Created October 4, 2019 05:48
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/7519dec03900e1931d8ae47928899897 to your computer and use it in GitHub Desktop.
Save jasongorman/7519dec03900e1931d8ae47928899897 to your computer and use it in GitHub Desktop.
import unittest
from pricer import Pricer
class VideoInfoStub(object):
def __init__(self, title, rating):
self.title = title
self.rating = rating
def fetch_video_info(self, imdbID):
return self.title, self.rating
class PricerTest(unittest.TestCase):
def test_price_high_rated_video(self):
video_info = VideoInfoStub('The Abyss', 7.1)
pricer = Pricer(video_info)
video = pricer.price('tt0096754')
self.assertEqual(4.95, video.price)
def test_price_medium_rated_video(self):
video_info = VideoInfoStub('Daddy Day Care', 5.5)
pricer = Pricer(video_info)
video = pricer.price('tt0317303')
self.assertEqual(3.95, video.price)
def test_price_low_rated_video(self):
video_info = VideoInfoStub('Manos: The Hand Of Fate', 1.9)
pricer = Pricer(video_info)
video = pricer.price('tt0060666')
self.assertEqual(2.95, video.price)
if __name__ == '__main__':
unittest.main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment