def test_link_update_request(link_update_req): DB = [] assert reactToAMQPMessage(link_update_req, lambda x: DB.append(x)) is None assert reactToAMQPMessage(link_update_req, lambda x: DB.append(x)) is None assert DB == [] assert reactToAMQPMessage(StatusRequest(), lambda x: DB.append(x)) is None
def test_one_link_status_request(): with open(os.path.join(TMP_DIR, "responses.xml"), "w") as f: f.write(RESPONSE_STR) DB = [] resp = reactToAMQPMessage(StatusRequest(), lambda x: DB.append(x)) assert not DB assert resp.session_id == "session_id" assert resp.status == "OK" # test that the queue was cleaned DB = [] resp = reactToAMQPMessage(StatusRequest(), lambda x: DB.append(x)) assert not DB assert not resp
def test_link_status_request(): with open(os.path.join(TMP_DIR, "responses.xml"), "w") as f: f.write(THREE_RESPONSES_STR) DB = [] resp = reactToAMQPMessage(StatusRequest(), lambda x: DB.append(x)) assert len(DB) == 2 assert DB[0].session_id == "aaa" assert DB[0].status == "OK" assert DB[1].session_id == "bbb" assert DB[1].status == "OK" assert resp.session_id == "ccc" assert resp.status == "ERROR"