#!/bin/bash
set -eu

TESTDIR=$(readlink -f $(dirname $0))

case "$APT_TEST_METHOD" in
	https|https_*)
		APT_TEST_METHOD=https_invalid_cert_hostname
		;;
	*)
		echo 'SKIP (makes sense only for APT_TEST_METHOD being https*)' >&2
		exit 0
		;;
esac

. $TESTDIR/framework

setupenvironment

buildpackage 'simple-package'

generaterepository_and_switch_sources "$TMPWORKINGDIRECTORY/usr/src/RPM/RPMS"

testfailure aptget update

testpkgnotinstalled 'simple-package'
testfailure aptget install simple-package
testpkgnotinstalled 'simple-package'
