#!/bin/sh

set -e

. ./helpers.sh

# Without UPSTREAM_GIT and without --ask-upstream-git, the guess for a
# source which does exist on github.com/openstack must be verified with
# git ls-remote and then used. This test is skipped when github.com is
# unreachable (eg: during a package build).

timeout 10 git ls-remote --exit-code https://github.com/openstack/python-aodhclient HEAD >/dev/null 2>&1 || exit 0

set_stub_rmadison "" 0
make_fixture "1.0.0-1" unstable "python-aodhclient" ""

run_modernize
assert_eq "exit code" "${MODERNIZE_RC}" "0"
assert_contains "guessed url" "$(cat debian/watch)" \
	"https://github.com/openstack/python-aodhclient refs/tags/(\d[brc\d\.]+)"
assert_contains "watch commit" "$(git log --format=%s)" "Update debian/watch to version=4 mode=git"

exit 0
