#! /usr/bin/env bats setup() { bats_require_minimum_version 1.5.0 } @test "wrong server" { cat "$CFGFILE" | sed "s/$FREEPORT/22/" > "$CFGFILE".wrongserver.toml cat "$CFGFILE".wrongserver.toml run -1 "$BIN_PATH" -c "$CFGFILE".wrongserver.toml list echo "$output" echo "$output" | grep "request error: error sending request" } @test "wrong login" { cat "$CFGFILE" | sed 's/admin/user/g' > "$CFGFILE".wronguser.toml cat "$CFGFILE".wronguser.toml run -1 "$BIN_PATH" -c "$CFGFILE".wronguser.toml list echo "$output" echo "$output" | grep "Failed to login.*user" } @test "empty list" { run "$BIN_PATH" -c "$CFGFILE" list echo "$output" [[ "$output" = "[]" ]] } @test "add ISO" { run "$BIN_PATH" -c "$CFGFILE" add --paused "magnet:?xt=urn:btih:a982743fdb1115a0e501cabb75cca85c828f9445&dn=tails-amd64-4.29-img&tr=udp%3a%2f%2ftracker.torrent.eu.org%3a451&tr=udp%3a%2f%2ftracker.coppersurfer.tk%3a6969" echo "$output" [[ "$output" = "" ]] } @test "add broken magnet" { run -1 "$BIN_PATH" -c "$CFGFILE" add --paused "magnet:?qsdjksqdjsqdsqdsqldkqs" echo "$output" echo "$output" | grep "Other error:" } @test "get info about ISO" { run "$BIN_PATH" -c "$CFGFILE" get "a982743fdb1115a0e501cabb75cca85c828f9445" echo "$output" echo "$output" | grep 'a982743fdb1115a0e501cabb75cca85c828f9445' } @test "non-empty list" { run "$BIN_PATH" -c "$CFGFILE" list echo "$output" echo "$output" | grep "a982743fdb1115a0e501cabb75cca85c828f9445" }