def test_ueimporterror():
    ue = uecommunication()
    raises(UeImportError, ue.valid_response, "<Response><Import>Import not ok</Import></Response>")
    assert (
        ue.valid_response("<Response><Import>Import ok</Import></Response>")
        == "<Response><Import>Import ok</Import></Response>"
    )
def test_ueimporterror():
    ue = uecommunication()
    raises(UeImportError, ue.valid_response,
           "<Response><Import>Import not ok</Import></Response>")
    assert ue.valid_response(
            "<Response><Import>Import ok</Import></Response>") ==\
            "<Response><Import>Import ok</Import></Response>"
def test_uereadresponse():
    ue = uecommunication()
    raises(UeReadResponse, ue.valid_response, "<foo></bar>")
def test_send_bad_adress():
    ue = uecommunication()
    options = Options()
    raises(URLError, ue.send_inventory, "https://bad_url:1979/post/",
           str(xml_valid()), options)
def test_send_not_valid_inventory():
    ue = uecommunication()
    options = Options()
    raises(UeResponseError, ue.send_inventory, "https://127.0.0.1:1979/post/",
           str(xml_not_valid()), options)
def test_send_valid_inventory():
    ue = uecommunication()
    options = Options()
    assert ue.send_inventory("https://127.0.0.1:1979/post/", str(xml_valid()),
                             options) == response_valid_inventory()
def test_ueresponseerror():
    ue = uecommunication()
    raises(UeResponseError, ue.valid_response,
           "<Response><status></status></Response>")
def test_uereadresponse():
    ue = uecommunication()
    raises(UeReadResponse, ue.valid_response, "<foo></bar>")
def test_send_bad_adress():
    ue = uecommunication()
    options = Options()
    raises(URLError, ue.send_inventory, "https://bad_url:1979/post/", str(xml_valid()), options)
def test_send_not_valid_inventory():
    ue = uecommunication()
    options = Options()
    raises(UeResponseError, ue.send_inventory, "https://127.0.0.1:1979/post/", str(xml_not_valid()), options)
def test_send_valid_inventory():
    ue = uecommunication()
    options = Options()
    assert ue.send_inventory("https://127.0.0.1:1979/post/", str(xml_valid()), options) == response_valid_inventory()
def test_ueresponseerror():
    ue = uecommunication()
    raises(UeResponseError, ue.valid_response, "<Response><status></status></Response>")