Ejemplo n.º 1
0
def test_get_users_unclaimed():

    endpoint = "/users/unclaimed?primaryPersona=:primary_persona&ageRange=:age_range"
    params = {
        ":primary_persona": os.getenv('TEST_PRIMARY_PERSONA'),
        ":age_range": os.getenv("TEST_AGE_RANGE")
    }
    integhelpers.get_request_assert(users_api_url, endpoint, schemas_path,
                                    params)
def test_get_recommendations_should_return_image_filename_by_default():
    endpoint = "/recommendations?userID=:userID&feature=:feature&currentItemID"
    params = DEFAULT_PARAMS
    response = get_request_assert(recommendation_api_url, endpoint, schemas_path, params)
    recommendation_resp_obj = response.json()
    image_field = recommendation_resp_obj[0]["product"]["image"]

    assert_that(image_field.startswith("http://")).is_false()
Ejemplo n.º 3
0
def test_get_related_with_default_params_should_return_a_non_empty_list_of_product(
):
    endpoint = "/related?userID=:userID&feature=:feature&currentItemID=:currentItemID}"
    params = DEFAULT_PARAMS
    response = get_request_assert(recommendation_api_url, endpoint,
                                  schemas_path, params)
    related_resp_obj = response.json()

    assert_that(related_resp_obj).is_not_empty()
Ejemplo n.º 4
0
def test_get_popular_with_fullyQualifyImageUrls_should_return_image_url():
    endpoint = "/popular?userID=:userID&feature=:feature&fullyQualifyImageUrls=:fullyQualifyImageUrls"
    params = {**DEFAULT_PARAMS, ":fullyQualifyImageUrls": "1"}
    response = get_request_assert(recommendation_api_url, endpoint,
                                  schemas_path, params)

    recommendation_resp_obj = response.json()
    image_field = recommendation_resp_obj[0]["product"]["image"]
    assert_that(image_field).starts_with('http://')
Ejemplo n.º 5
0
def test_get_popular_with_numResults_should_return_exact_number_of_result():
    num_results = 3

    endpoint = "/popular?userID=:userID&feature=:feature&numResults=:numResults"
    params = {**DEFAULT_PARAMS, ":numResults": num_results}
    response = get_request_assert(recommendation_api_url, endpoint,
                                  schemas_path, params)
    recommendation_resp_obj = response.json()

    assert_that(recommendation_resp_obj).is_length(num_results)
def test_get_recommendations_with_currentItemID_should_return_different_product():
    # Calling without "currentItemID" param should get this product id
    endpoint = "/recommendations?userID=:userID&feature=:feature&currentItemID"
    params = DEFAULT_PARAMS
    response = get_request_assert(recommendation_api_url, endpoint, schemas_path, params)
    recommendation_resp_obj = response.json()
    first_item_id_without_param = recommendation_resp_obj[0]["product"]["id"]

    # Calling with this "currentItemID" param should get another product id
    currentItemID = "89728417-5269-403d-baa3-04b59cdffd0a"

    endpoint = "/recommendations?userID=:userID&feature=:feature&currentItemID=:currentItemID"
    params = {
        **DEFAULT_PARAMS,
        ":currentItemID": currentItemID
    }
    response = get_request_assert(recommendation_api_url, endpoint, schemas_path, params)
    recommendation_resp_obj = response.json()
    first_item_id = recommendation_resp_obj[0]["product"]["id"]

    assert_that(first_item_id).is_not_equal_to(first_item_id_without_param)
Ejemplo n.º 7
0
def test_get_orders_username():

    endpoint = "/orders/username/:username"
    params = {":order_id": os.getenv('TEST_USERNAME')}
    integhelpers.get_request_assert(orders_api_url, endpoint, schemas_path, params)
Ejemplo n.º 8
0
def test_get_orders_id():

    endpoint = "/orders/id/:order_id"
    params = {":order_id": os.getenv('TEST_ORDER_ID')}
    integhelpers.get_request_assert(orders_api_url, endpoint, schemas_path, params)
Ejemplo n.º 9
0
def test_get_orders_all():

    endpoint = "/orders/all"
    integhelpers.get_request_assert(orders_api_url, endpoint, schemas_path)
Ejemplo n.º 10
0
def test_get_users_identity_id():

    endpoint = "/users/identityid/:identity_id"
    params = {":identity_id": os.getenv('TEST_IDENTITY_ID')}
    integhelpers.get_request_assert(users_api_url, endpoint, schemas_path,
                                    params)
Ejemplo n.º 11
0
def test_get_products_category():

    endpoint = "/products/category/:category_name"
    params = {":category_name": os.getenv('TEST_CATEGORY_ID')}
    integhelpers.get_request_assert(products_api_url, endpoint, schemas_path,
                                    params)
Ejemplo n.º 12
0
def test_get_products_featured():

    endpoint = "/products/featured"
    integhelpers.get_request_assert(products_api_url, endpoint, schemas_path)
Ejemplo n.º 13
0
def test_get_products_id():

    endpoint = "/products/id/:product_id"
    params = {":product_id": os.getenv('TEST_PRODUCT_ID')}
    integhelpers.get_request_assert(products_api_url, endpoint, schemas_path,
                                    params)
Ejemplo n.º 14
0
def test_get_coupon_offer_should_return_with_correct_schema():
    endpoint = "/coupon_offer?userID=:userID"
    params = {":userID": "5097"}
    get_request_assert(recommendation_api_url, endpoint, schemas_path, params)
Ejemplo n.º 15
0
def test_get_users_random():

    endpoint = "/users/random"
    integhelpers.get_request_assert(users_api_url, endpoint, schemas_path)
def test_get_recommendations_should_return_products_with_correct_schema():
    endpoint = "/recommendations?userID=:userID&feature=:feature"
    params = DEFAULT_PARAMS 
    get_request_assert(recommendation_api_url, endpoint, schemas_path, params)
Ejemplo n.º 17
0
def test_get_categories_all():

    endpoint = "/categories/all"
    integhelpers.get_request_assert(products_api_url, endpoint, schemas_path)
Ejemplo n.º 18
0
def test_get_categories_id():

    endpoint = "/categories/id/:category_id"
    params = {":category_id": os.getenv('TEST_CATEGORY_ID')}
    integhelpers.get_request_assert(products_api_url, endpoint, schemas_path,
                                    params)
Ejemplo n.º 19
0
def test_get_users_id():

    endpoint = "/users/id/:user_id"
    params = {":user_id": os.getenv('TEST_USER_ID')}
    integhelpers.get_request_assert(users_api_url, endpoint, schemas_path,
                                    params)