예제 #1
0
파일: test.py 프로젝트: pippo314/pytarallo
def test_add_products():
    # delete product
    # variant timestamp o number casuale
    tarallo_session = Tarallo(t_url, t_token)
    data = {
        "brand": "testBrand",
        "model": "testModel",
        "variant": "testVariant",
        "features": {
            "psu-volt": 19
        }
    }
    tarallo_session.delete_product(data.get("brand"), data.get("model"),
                                   data.get("variant"))
    p = ProductToUpload(data)
    assert tarallo_session.add_product(p)  #raises ValidationError ??
예제 #2
0
파일: test.py 프로젝트: WEEE-Open/pytarallo
def test_add_remove_products():
    tarallo_session = Tarallo(t_url, t_token)
    data = {
        "brand": "testBrand",
        "model": "testModel",
        "variant": "testVariant",
        "features": {"psu-volt": 19}
    }
    deleted = tarallo_session.delete_product(data.get("brand"), data.get("model"), data.get("variant"))
    assert deleted or deleted is None
    p = ProductToUpload(data)
    assert tarallo_session.add_product(p)
예제 #3
0
파일: test.py 프로젝트: WEEE-Open/pytarallo
def test_add_duplicate_products():
    tarallo_session = Tarallo(t_url, t_token)
    data = {
        "brand": "testBrand",
        "model": "testModel",
        "variant": "testVariant",
        "features": {"psu-volt": 12}
    }
    p = ProductToUpload(data)
    # Remove and add
    deleted = tarallo_session.delete_product(data.get("brand"), data.get("model"), data.get("variant"))
    assert deleted or deleted is None
    assert tarallo_session.add_product(p)
    # This one fails
    tarallo_session.add_product(p)