summaryrefslogtreecommitdiffstatshomepage
path: root/test/tst-status-once.sh
blob: 50835995c2be4d67c59b539ee9afb9fd69892261 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
test_run() {
    local users=(egor.tensin kreed58)
    local db_path
    db_path="$test_root_dir/db.csv"

    test_run_module vk.tracking.status --only-once -o "$db_path" "${users[@]}"

    if [ ! -s "$db_path" ]; then
        fail "Database file '$db_path' either doesn't exists or is empty"
        return 1
    fi

    log "Database:"
    cat -- "$db_path" >&2

    local lines
    lines="$( cat -- "$db_path" | wc -l )"

    if [ "$lines" -ne 2 ]; then
        fail "Database '$db_path' has the wrong number of entries"
        return 1
    fi
}