def test_DataLoom(self): search_term = "The Data Loom" driver = amazon_driver() expected = "https://images-na.ssl-images-amazon.com/images/I/41gHdOK6zPL._SX331_BO1,204,203,200_.jpg" actual = extract_image( choose_result(amazon_search(driver, search_term), search_term)) driver.quit() assert actual == expected, f"Expected: {expected}, Actual: {actual}"
def test_RhythmOfWar(self): search_term = "Rhythm of War" driver = amazon_driver() expected = "https://m.media-amazon.com/images/I/61kddyNOd5L.jpg" actual = extract_image( choose_result(amazon_search(driver, search_term), search_term)) driver.quit() assert actual == expected, f"Expected: {expected}, Actual: {actual}"
def test_DataLoom(self): search_term = "The Data Loom" expected = "Stephen Few" driver = amazon_driver() actual = extract_author( choose_result(amazon_search(driver, search_term), search_term)) driver.quit() assert actual == expected, f"Expected: {expected}, Actual: {actual}"
def test_RhythmOfWar(self): search_term = "Rhythm of War" expected = "Brandon Sanderson" driver = amazon_driver() actual = extract_author( choose_result(amazon_search(driver, search_term), search_term)) driver.quit() assert actual == expected, f"Expected: {expected}, Actual: {actual}"
def test_the_data_loom(self): search_term = "The Data Loom" driver = amazon_driver() url = choose_result(amazon_search(driver, search_term), search_term).current_url expected_url = "https://www.amazon.com/dp/1938377117" actual_url = truncate_url(url) driver.quit() assert actual_url == expected_url, f"Expected: {expected_url}, Actual {actual_url}"
def test_working_url(self): search_term = "The Data Loom" driver = amazon_driver() local_driver = amazon_search(driver, search_term) expected_url = "https://www.amazon.com/s?k=The+Data+Loom&i=stripbooks&ref=nb_sb_noss" actual_url = local_driver.current_url driver.quit() assert actual_url == expected_url, f"Expected: {expected_url}, Actual {actual_url}"
def test_ThinkingFastAndSlow(self): search_term = "Thinking, Fast and Slow" expected_title = search_term driver = amazon_driver() expected_subtitle = '' actual_title, actual_subtitle = extract_title( choose_result(amazon_search(driver, search_term), search_term)) driver.quit() assert actual_title == expected_title, f"Expected: {expected_title}, Actual: {actual_title}" assert actual_subtitle == expected_subtitle, f"Expected: {expected_subtitle}, Actual: {actual_subtitle}"
def test_RhythmOfWar(self): search_term = "Rhythm of War" expected_title = search_term driver = amazon_driver() expected_subtitle = 'The Stormlight Archive, Book 4' actual_title, actual_subtitle = extract_title( choose_result(amazon_search(driver, search_term), search_term)) driver.quit() assert actual_title == expected_title, f"Expected: {expected_title}, Actual: {actual_title}" assert actual_subtitle == expected_subtitle, f"Expected: {expected_subtitle}, Actual: {actual_subtitle}"
def test_DataLoom(self): search_term = "The Data Loom" driver = amazon_driver() expected_title = "The Data Loom" expected_subtitle = "Weaving Understanding by Thinking Critically and Scientifically with Data" actual_title, actual_subtitle = extract_title( choose_result(amazon_search(driver, search_term), search_term)) driver.quit() assert actual_title == expected_title, f"Expected: {expected_title}, Actual: {actual_title}" assert actual_subtitle == expected_subtitle, f"Expected: {expected_subtitle}, Actual: {actual_subtitle}"