Blame lang/python/tests/initial.py

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