Initial pre-release
tmux-party: share a tmux session with people on the same UNIX host. Single-file POSIX shell (party) with a filesystem + tmux server-access trust model. See README.md.
This commit is contained in:
commit
6be0ac1877
20 changed files with 3869 additions and 0 deletions
51
tests/70-moderation.bats
Normal file
51
tests/70-moderation.bats
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
#!/usr/bin/env bats
|
||||
|
||||
load 'helpers'
|
||||
|
||||
setup() {
|
||||
setup_party_sandbox
|
||||
require_party_group
|
||||
}
|
||||
teardown() { teardown_party_sandbox; }
|
||||
|
||||
party_rec() { printf '%s/party-%s:%s.d/roster\n' "$PARTY_SOCKET_DIR" "$USER" "$1"; }
|
||||
|
||||
@test "party invite adds user to access list" {
|
||||
"$PARTY_BIN" host invtest
|
||||
other=$(pick_other_user); [ -n "$other" ] || skip "no second user"
|
||||
"$PARTY_BIN" invite "$other"
|
||||
rec=$(party_rec invtest)
|
||||
sock=$(awk -F= '$1=="SOCKET"{print $2}' "$rec")
|
||||
tmux -S "$sock" server-access -l | grep -q "^$other"
|
||||
}
|
||||
|
||||
@test "party invite -r adds user as read-only" {
|
||||
"$PARTY_BIN" host invro
|
||||
other=$(pick_other_user); [ -n "$other" ] || skip
|
||||
"$PARTY_BIN" invite "$other" -r
|
||||
rec=$(party_rec invro)
|
||||
sock=$(awk -F= '$1=="SOCKET"{print $2}' "$rec")
|
||||
tmux -S "$sock" server-access -l | grep "^$other" | grep -qiE 'read|\(R\)'
|
||||
}
|
||||
|
||||
@test "party voice / party mute toggle write access" {
|
||||
"$PARTY_BIN" host vmtest
|
||||
other=$(pick_other_user); [ -n "$other" ] || skip
|
||||
"$PARTY_BIN" invite "$other" -r
|
||||
"$PARTY_BIN" voice "$other"
|
||||
"$PARTY_BIN" mute "$other"
|
||||
}
|
||||
|
||||
@test "party kick removes from access list and kills guest session" {
|
||||
"$PARTY_BIN" host ktest
|
||||
other=$(pick_other_user); [ -n "$other" ] || skip
|
||||
"$PARTY_BIN" invite "$other"
|
||||
rec=$(party_rec ktest)
|
||||
sock=$(awk -F= '$1=="SOCKET"{print $2}' "$rec")
|
||||
# Inject a fake guest session as if the user had joined.
|
||||
tmux -S "$sock" new-session -d -t ktest -s "__party_guest_$other"
|
||||
"$PARTY_BIN" kick "$other"
|
||||
! tmux -S "$sock" server-access -l | grep -q "^$other"
|
||||
! tmux -S "$sock" has-session -t "__party_guest_$other" 2>/dev/null
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue