File: install.bats

package info (click to toggle)
awscli 2.31.35-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 156,692 kB
  • sloc: python: 213,816; xml: 14,082; makefile: 189; sh: 178; javascript: 8
file content (31 lines) | stat: -rw-r--r-- 755 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env bats

setup() {
    if [ -z "$INSTALLER_TO_TEST" ]; then
	INSTALLER_TO_TEST="../../dist/AWS-CLI-Installer.pkg"
    fi
    PKG_PATH="$BATS_TMPDIR/installer.pkg"
    CHOICE_XML="$BATS_TMPDIR/choices.xml"
    INSTALL_TARGET="$HOME/.tmp-cli-pkg-test"
    mkdir -p "$INSTALL_TARGET"
    copy_pkg
}

teardown() {
    rm -rf "$INSTALL_TARGET"
}

copy_pkg() {
    cp "$INSTALLER_TO_TEST" "$PKG_PATH"
}

write_choices() {
    sed "s+REPLACEME+$1+g" > "$CHOICE_XML" < choices.xml
}

@test "user install with custom location succeeds" {
    write_choices "$INSTALL_TARGET"
    installer -target CurrentUserHomeDirectory -pkg "$PKG_PATH" -applyChoiceChangesXML "$CHOICE_XML"
    run "$INSTALL_TARGET/aws-cli/aws" "--version"
    [ "$status"  -eq 0 ]
}