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'
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"]
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
def test_get_product(): tarallo_session = Tarallo(t_url, t_token) p = tarallo_session.get_product("testBrand", "testModel", "testVariant") assert type(p) == Product assert p.brand == "testBrand" assert p.model == "testModel" assert p.variant == "testVariant" assert isinstance(p.features, dict)
def test_get_product2(): tarallo_session = Tarallo(t_url, t_token) p = tarallo_session.get_product("Samsung", "S667ABC1024", "v1") assert type(p) == Product assert p.brand == "Samsung" assert p.model == "S667ABC1024" assert p.variant == "v1" assert isinstance(p.features, dict) assert len(p.features) > 0