Skip to content

Commit

Permalink
Add basic Foreman tests to replace fb-test-foreman.bats
Browse files Browse the repository at this point in the history
Additionally replaces fb-test-katello.bats
  • Loading branch information
ehelms committed Jan 7, 2021
1 parent e4ee39e commit 8b70e38
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions tests/test_foreman.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import pytest

from urllib.parse import urlparse


def test_foreman_version(api, variables):
try:
expected_foreman_version = variables['expected_foreman_version']
except KeyError:
pytest.skip("'expected_foreman_version' is not set")
else:
status = api.resource('home').call('status')
assert status['version'] == expected_foreman_version


def test_ping(api):
ping = api.resource('ping').call('ping')['results']

assert ping['foreman']['database']['active']

if 'katello' in ping:
assert ping['katello']['status'] == 'ok'
try:
assert ping['katello']['status'] == 'ok'
except KeyError:
pytest.skip("'katello plugin' is not present")


def test_check_smart_proxy_registered(api, base_url):
hostname = urlparse(base_url).hostname
assert api.resource('smart_proxies').call('show', {'id': hostname})

0 comments on commit 8b70e38

Please sign in to comment.