예제 #1
0
def test_clean_lru(preprocessor_fixture):
    """
    测试清除lru
    """
    helper.clean_table("www.test-host.com_80_ResultList")
    Communicator().set_clean_lru(["www.test-host.com_80"])
    try:
        r = http_sender.send_json(http_data["new_request_1"], api_path)
    except Exception as e:
        assert False
    else:
        assert r.status_code == 200
        assert json.loads(r.text)["status"] == 0
        assert helper.get_data_count("www.test-host.com_80_ResultList") == 1
예제 #2
0
def test_send_duplicate_data(preprocessor_fixture):
    """
    测试重复的new_request类json处理
    """
    try:
        r2 = http_sender.send_json(http_data["new_request_2"], api_path)
        r1 = http_sender.send_json(http_data["new_request_1"], api_path)
    except Exception as e:
        assert False
    else:
        assert r1.status_code == 200 and r2.status_code == 200
        assert json.loads(r1.text)["status"] == 0 and json.loads(
            r2.text)["status"] == 0
        assert helper.get_data_count("www.test-host.com_80_ResultList") == 2