81 lines
3.1 KiB
Bash
Executable File
81 lines
3.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# /****************************************************************************
|
|
# * <Novell-copyright>
|
|
# * Copyright (c) 2001 Novell, Inc. All Rights Reserved.
|
|
# *
|
|
# * This program is free software; you can redistribute it and/or
|
|
# * modify it under the terms of version 2 of the GNU General Public License
|
|
# * as published by the Free Software Foundation.
|
|
# *
|
|
# * This program is distributed in the hope that it will be useful,
|
|
# * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# * GNU General Public License for more details.
|
|
# *
|
|
# * You should have received a copy of the GNU General Public License
|
|
# * along with this program; if not, contact Novell, Inc.
|
|
# *
|
|
# * To contact Novell about this file by physical or electronic mail, you
|
|
# * may find current contact information at www.novell.com.
|
|
# * </Novell-copyright>
|
|
# ****************************************************************************/
|
|
|
|
set -euo pipefail
|
|
|
|
temporary=$(mktemp -d "${TMPDIR:-/tmp}/bongo-python-runtime.XXXXXX")
|
|
trap 'rm -rf -- "$temporary"' EXIT
|
|
export PYTHONPYCACHEPREFIX="${temporary}/pycache"
|
|
|
|
python3 -m compileall -q \
|
|
"$(python3 -c 'import sysconfig; print(sysconfig.get_path("purelib"))')/bongo" \
|
|
"$(python3 -c 'import sysconfig; print(sysconfig.get_path("purelib"))')/bongo_web"
|
|
|
|
python3 - <<'PY'
|
|
import io
|
|
|
|
from bongo import table
|
|
from bongo.Console import wrap
|
|
from bongo.configuration.cli import main_admin, main_setup
|
|
from bongo.configuration.spamassassin_update import main as sa_update_main
|
|
from bongo.external.simpletal import simpleTAL, simpleTALES
|
|
from bongo.external.simpletal.simpleElementTree import parseFile
|
|
from bongo.storetool import BackupCommands, CalendarCommands, MailCommands
|
|
|
|
assert callable(main_admin)
|
|
assert callable(main_setup)
|
|
assert callable(sa_update_main)
|
|
assert isinstance(wrap("Grüße 世界", width=8), str)
|
|
assert "Müller" in table.format_table(["Name"], [["Müller"]])
|
|
|
|
context = simpleTALES.Context()
|
|
context.addGlobal("name", "A&B")
|
|
template = simpleTAL.compileHTMLTemplate(
|
|
'<p tal:content="name">placeholder</p>')
|
|
output = io.StringIO()
|
|
template.expand(context, output)
|
|
assert output.getvalue() == "<p>A&B</p>"
|
|
|
|
root = parseFile(io.StringIO("<root><child>value</child></root>"))
|
|
assert root.find("child").text == "value"
|
|
PY
|
|
|
|
bongo-admin --help >"${temporary}/bongo-admin.help"
|
|
bongo-storetool --help >"${temporary}/bongo-storetool.help"
|
|
bongo-queuetool --help >"${temporary}/bongo-queuetool.help"
|
|
bongo-web --help >"${temporary}/bongo-web.help"
|
|
bongodirector --help >"${temporary}/bongodirector.help"
|
|
/usr/libexec/bongo/bongo-sa-update --help \
|
|
>"${temporary}/bongo-sa-update.help"
|
|
|
|
set +e
|
|
/usr/libexec/bongo/bongo-acme-dns-provider \
|
|
--config "${temporary}/missing.json" --provider audit --type nsupdate \
|
|
--operation present --record _acme-challenge.example.test \
|
|
--value audit --ttl 60 >"${temporary}/bongo-acme.json"
|
|
status=$?
|
|
set -e
|
|
test "${status}" -eq 1
|
|
grep -q '"ok":false' "${temporary}/bongo-acme.json"
|
|
|
|
echo "PYTHON-3 PASS compileall=installed imports=config,storetool,template,xml cli=7"
|