Exemplo n.º 1
0
def test_update_p_feature():
    tarallo_session = Tarallo(t_url, t_token)
    p = tarallo_session.get_product('AMD', 'Opteron 3300', 'AJEJE')
    new_features = p.features
    new_features['type'] = 'ram'
    tarallo_session.update_product_features('AMD', 'Opteron 3300', 'AJEJE',
                                            new_features)
    p = tarallo_session.get_product('AMD', 'Opteron 3300', 'AJEJE')
    assert p.features["type"] == 'ram'
Exemplo n.º 2
0
def test_update_product_feature():
    tarallo_session = Tarallo(t_url, t_token)
    p = tarallo_session.get_product('AMD', 'Opteron 3300', 'AJEJE')
    assert p.features['type'] == 'cpu'
    if 'color' in p.features and p.features['color'] == 'red':
        new_features = {"color": "grey"}
    else:
        new_features = {"color": "red"}

    tarallo_session.update_product_features('AMD', 'Opteron 3300', 'AJEJE', new_features)

    p = tarallo_session.get_product('AMD', 'Opteron 3300', 'AJEJE')
    assert p.features["type"] == 'cpu'
    assert p.features["color"] == new_features["color"]
Exemplo n.º 3
0
def test_delete_product_feature():
    tarallo_session = Tarallo(t_url, t_token)
    p = tarallo_session.get_product('AMD', 'Opteron 3300', 'AJEJE')
    assert p.features['type'] == 'cpu'
    # Add feature if missing
    if 'color' not in p.features and p.features['color'] == 'red':
        new_features = {"color": "grey"}
        tarallo_session.update_product_features('AMD', 'Opteron 3300', 'AJEJE', new_features)
        p = tarallo_session.get_product('AMD', 'Opteron 3300', 'AJEJE')
    assert "color" in p.features

    new_features = {"color": None}
    tarallo_session.update_product_features('AMD', 'Opteron 3300', 'AJEJE', new_features)
    p = tarallo_session.get_product('AMD', 'Opteron 3300', 'AJEJE')
    assert p.features["type"] == 'cpu'
    assert "color" not in p.features