Ejemplo n.º 1
0
def test_delete_conf_without_info():
    c_id = add_conf_get_id()
    with pytest.raises(subprocess.CalledProcessError):
        subprocess.run(CMD_PREFIX + ['-Cd'], **SUBPROCESS_KWARGS)
    query_result = db.cursor().execute(
        "SELECT COUNT(id) FROM ssrconf WHERE id = {}".format(c_id)).fetchone()
    assert query_result[0] == 1
Ejemplo n.º 2
0
def test_delete_conf():
    c_ids = [add_conf_get_id(), add_conf_get_id()]
    subprocess.run(CMD_PREFIX +
                   ['-Cdc', str(c_ids[0]), '-c',
                    str(c_ids[1])], **SUBPROCESS_KWARGS)
    query_result = db.cursor().execute(
        "SELECT COUNT(id) FROM ssrconf WHERE id = {} OR id = {}".format(
            *c_ids)).fetchone()
    assert query_result[0] == 0
Ejemplo n.º 3
0
def _check_updated_subs(s_ids: List[int]):
    cursor = db.cursor()
    for s_id in s_ids:
        query_result = cursor.execute(
            "SELECT server, server_port FROM ssrconf WHERE sub_id = {}".format(s_id)).fetchone()
        assert query_result == ('::1', 30000)
Ejemplo n.º 4
0
def test_delete_all_sub():
    add_sub_get_id()
    subprocess.run(CMD_PREFIX + ['-Sda'], **SUBPROCESS_KWARGS)
    query_result = db.cursor().execute("SELECT COUNT(id) FROM ssrsub").fetchone()
    assert query_result[0] == 0
Ejemplo n.º 5
0
def test_add_sub():
    s_id = add_sub_get_id()
    query_result = db.cursor().execute("SELECT COUNT(id) FROM ssrsub WHERE id = {}".format(s_id)).fetchone()
    assert query_result[0] == 1
Ejemplo n.º 6
0
def test_add_conf_by_share_url():
    c_id = add_conf_get_id()
    query_result = db.cursor().execute(
        "SELECT COUNT(id) FROM ssrconf WHERE id = {}".format(c_id)).fetchone()
    assert query_result[0] == 1