Blame lang/python/tests/initial.py

Packit d7e8d0
#!/usr/bin/env python
Packit d7e8d0
Packit d7e8d0
# Copyright (C) 2016 g10 Code GmbH
Packit d7e8d0
#
Packit d7e8d0
# This file is part of GPGME.
Packit d7e8d0
#
Packit d7e8d0
# GPGME is free software; you can redistribute it and/or modify it
Packit d7e8d0
# under the terms of the GNU General Public License as published by
Packit d7e8d0
# the Free Software Foundation; either version 2 of the License, or
Packit d7e8d0
# (at your option) any later version.
Packit d7e8d0
#
Packit d7e8d0
# GPGME is distributed in the hope that it will be useful, but WITHOUT
Packit d7e8d0
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
Packit d7e8d0
# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General
Packit d7e8d0
# Public License for more details.
Packit d7e8d0
#
Packit d7e8d0
# You should have received a copy of the GNU Lesser General Public
Packit Service 30b792
# License along with this program; if not, see <https://www.gnu.org/licenses/>.
Packit d7e8d0
Packit d7e8d0
from __future__ import absolute_import, print_function, unicode_literals
Packit d7e8d0
Packit d7e8d0
import os
Packit d7e8d0
import subprocess
Packit d7e8d0
import gpg
Packit d7e8d0
import support
Packit d7e8d0
Packit Service 30b792
del absolute_import, print_function, unicode_literals
Packit Service 30b792
Packit d7e8d0
print("Using gpg module from {0!r}.".format(os.path.dirname(gpg.__file__)))
Packit d7e8d0
Packit Service 30b792
subprocess.check_call([
Packit Service 30b792
    os.path.join(os.getenv('top_srcdir'), "tests", "start-stop-agent"),
Packit Service 30b792
    "--start"
Packit Service 30b792
])
Packit d7e8d0
Packit d7e8d0
with gpg.Context() as c:
Packit d7e8d0
    alpha = c.get_key("A0FF4590BB6122EDEF6E3C542D727CC768697734", False)
Packit d7e8d0
    bob = c.get_key("D695676BDCEDCC2CDD6152BCFE180B1DA9E3B0B2", False)
Packit d7e8d0
Packit d7e8d0
    # Mark alpha as trusted.  The signature verification tests expect
Packit d7e8d0
    # this.
Packit d7e8d0
    support.mark_key_trusted(c, alpha)
Packit d7e8d0
Packit d7e8d0
    c.op_import(open(support.in_srcdir("encrypt-only.asc")))
Packit d7e8d0
    c.op_import(open(support.in_srcdir("sign-only.asc")))