24 lines
662 B
Python
24 lines
662 B
Python
import os
|
|
|
|
import testinfra.utils.ansible_runner
|
|
|
|
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
|
|
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('gitea')
|
|
|
|
|
|
def test_gitea_service(host):
|
|
assert host.service('gitea').is_running
|
|
assert host.service('gitea').is_enabled
|
|
|
|
|
|
def test_gitea_with_https(host):
|
|
cmd = host.run("curl -I -k -H Host:git.localhost https://127.0.0.1")
|
|
assert cmd.rc == 0
|
|
assert "HTTP/2 200" in cmd.stdout
|
|
|
|
|
|
def test_gitea_redirection_with_http(host):
|
|
cmd = host.run("curl -I -H Host:git.localhost http://127.0.0.1")
|
|
assert cmd.rc == 0
|
|
assert "HTTP/1.1 307 Temporary Redirect" in cmd.stdout
|