#!/usr/bin/env bash

setup_file(){
  load "$PWD/tests/integration/helpers/common"
  _common_setup
  _add_server
  _add_move_server
  _new_app
}

teardown_file(){
  _rm_app
  _rm_server
  _rm_move_server
}

setup(){
  load "$PWD/tests/integration/helpers/common"
  _common_setup
  _ensure_catalogue
}

teardown(){
  _undeploy_app
}

@test "validate app argument" {
  run $ABRA app move
  assert_failure

  run $ABRA app move DOESNTEXIST
  assert_failure

  run $ABRA app move "$TEST_APP_DOMAIN" DOESNTEXIST
  assert_failure
}

@test "move app fails if not deployed" {
  run $ABRA app move "$TEST_APP_DOMAIN" "$TEST_MOVE_SERVER"
  assert_failure
  assert_output --partial 'must first be deployed'
}
