DFY-NCSU / slash-phase6

Slash is a web application that scrapes the most popular e-commerce websites for the best deals so that you can get the best value for your money!
MIT License
3 stars 3 forks source link

Test Costco API #29

Closed TomasAndersonFang closed 6 hours ago

TomasAndersonFang commented 6 hours ago

Issue Description

The test_api_costco.py function is tested across multiple test cases to validate its output structure and data consistency. However, the following issues were observed:

  1. Output Consistency:

    • The test cases expect the output to be a list of dictionaries with specific keys (title, price, website, link, img_link, timestamp).
    • If the API response is not consistent or lacks any of these keys, the assertions fail. This has been observed intermittently.
  2. Unexpected Empty Fields:

    • Test cases such as test_api_costco_collected_produce_title, test_api_costco_collected_produce_link, test_api_costco_collected_produce_img_link, and test_api_costco_collected_produce_timestamp check for non-empty values in specific fields. If any field is missing or empty, these tests will fail.
    • This raises concerns regarding the reliability of data extraction from the source, particularly when certain fields are unexpectedly empty.
  3. Price Validation:

    • In test_api_costco_collected_produce_price, the check_price function verifies that all price values are valid floats after removing $ and ,. However, invalid or inconsistent formats may lead to ValueError exceptions, failing this test.
    • Price sorting in test_api_costco_collected_produce_order might also fail if prices are not properly formatted or extracted.

Affected Test Cases

Steps to Reproduce

  1. Run the test cases provided in the code snippet.
  2. Observe any intermittent test failures or inconsistencies in the test_api_costco.py response.

Expected Outcome

Actual Outcome

TomasAndersonFang commented 6 hours ago

Resolved #30