Ejemplo n.º 1
0
def test_is_product_exists_in_wishlist():
    product = {
        "id": "23",
        "name": "stan",
        "price": "100€",
        "rating": "4",
        "image": "http://exemple.com/stan.png"
    }
    app.create_wishlist({"id": "xtest1234"})
    app.add_product_wishlist("xtest1234", product)
    found, found_index = app.is_product_exists_in_wishlist("xtest1234", "23")
    assert found == True
    assert found_index == 0
Ejemplo n.º 2
0
def test_successful_add_product_wishlist():
    product = {
        "id": "23",
        "name": "stan",
        "price": "100€",
        "rating": "4",
        "image": "http://exemple.com/stan.png"
    }
    app.create_wishlist({"id": "xtest1234"})
    response = app.add_product_wishlist("xtest1234", product)
    assert response != None
    assert isinstance(response, tuple)
    assert response == (None, 201)
Ejemplo n.º 3
0
def test_failed_add_product_wishlist():
    product = {
        "id": "23",
        "name": "stan",
        "price": "100€",
        "rating": "4",
        "image": "http://exemple.com/stan.png"
    }
    app.create_wishlist({"id": "xtest1234"})
    response = app.add_product_wishlist("xtest1234", product)
    response = app.add_product_wishlist("xtest1234", product)
    assert response != None
    assert isinstance(response, tuple)
    assert response == ({
        'code': '400',
        'message': 'product already exists in this wishlist'
    }, 400)
Ejemplo n.º 4
0
def test_failed_create_wishlist():
    response = app.create_wishlist({"id": "xtest1234"})
    assert response != None
    assert isinstance(response, tuple)
    assert response == ({
        'code': '400',
        'message': 'This wishlist already exists'
    }, 400)
Ejemplo n.º 5
0
def test_successful_create_wishlist():
    response = app.create_wishlist({"id": "xtest1234"})
    assert response != None
    assert isinstance(response, tuple)
    assert response == (None, 201)