Skip to content

Commit

Permalink
Renamed test file. Checked PEP 8 style guide against files.
Browse files Browse the repository at this point in the history
  • Loading branch information
zachwill committed May 14, 2011
1 parent b6cd3e2 commit ab9fc1d
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions amazon_tests.py → tests.py
Expand Up @@ -26,14 +26,15 @@ def test_empty_intialization_fails(self):
self.assertRaises(TypeError, Product) self.assertRaises(TypeError, Product)


def test_initialization_with_fake_url(self): def test_initialization_with_fake_url(self):
movie = Product(self.url) movie = Product(self.url)
self.assertEqual( self.assertEqual(
movie.split_url.path, ('/Inception-Two-Disc/dp/B002ZG981E/' movie.split_url.path, ('/Inception-Two-Disc/dp/B002ZG981E/'
'ref=cm_pr_product_top')) 'ref=cm_pr_product_top'))
self.assertEqual( self.assertEqual(
movie.reviews_url.path, ('/Inception-Two-Disc/product-reviews/' movie.reviews_url.path, ('/Inception-Two-Disc/product-reviews/'
'B002ZG981E/ref=cm_pr_product_top')) 'B002ZG981E/ref=cm_pr_product_top'))



class TestStarReviewsUrl(unittest.TestCase): class TestStarReviewsUrl(unittest.TestCase):


def test_star_reviews_url_for_1_star(self): def test_star_reviews_url_for_1_star(self):
Expand Down Expand Up @@ -88,14 +89,14 @@ def setUp(self):
def test_star_reviewers_for_1_star_5_page(self): def test_star_reviewers_for_1_star_5_page(self):
Product('http://fake')._star_reviewers(1, 5) Product('http://fake')._star_reviewers(1, 5)
called_url = urlsplit(amazon.Request.call_args[0][0]) called_url = urlsplit(amazon.Request.call_args[0][0])
parsed_query = parse_qs(called_url.query) parsed_query = parse_qs(called_url.query)
assert 'addOneStar' in parsed_query['filterBy'] assert 'addOneStar' in parsed_query['filterBy']
assert '5' in parsed_query['pageNumber'] assert '5' in parsed_query['pageNumber']


def test_star_reviewers_for_3_star_2_page(self): def test_star_reviewers_for_3_star_2_page(self):
Product('http://fake')._star_reviewers(3, 2) Product('http://fake')._star_reviewers(3, 2)
called_url = urlsplit(amazon.Request.call_args[0][0]) called_url = urlsplit(amazon.Request.call_args[0][0])
parsed_query = parse_qs(called_url.query) parsed_query = parse_qs(called_url.query)
assert 'addThreeStar' in parsed_query['filterBy'] assert 'addThreeStar' in parsed_query['filterBy']
assert '2' in parsed_query['pageNumber'] assert '2' in parsed_query['pageNumber']


Expand Down

0 comments on commit ab9fc1d

Please sign in to comment.