# This file is part of GNUnet.
# (C) 2010, 2018 Christian Grothoff (and other contributing authors)
#
-# GNUnet is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published
-# by the Free Software Foundation; either version 2, or (at your
-# option) any later version.
+# GNUnet is free software: you can redistribute it and/or modify it
+# under the terms of the GNU Affero General Public License as published
+# by the Free Software Foundation, either version 3 of the License,
+# or (at your option) any later version.
#
# GNUnet 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.
+# Affero General Public License for more details.
#
-# You should have received a copy of the GNU General Public License
-# along with GNUnet; see the file COPYING. If not, write to the
-# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-# Boston, MA 02110-1301, USA.
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# SPDX-License-Identifier: AGPL3.0-or-later
#
# Testcase for ego revocation
-from __future__ import print_function
+
import sys
import os
import subprocess
TEST_CONFIGURATION = "test_revocation.conf"
TEST_REVOCATION_EGO = "revoc_test"
-get_clean = subprocess.Popen([config, '-c', TEST_CONFIGURATION, '-s', 'PATHS', '-o', 'GNUNET_HOME', '-f'], stdout=subprocess.PIPE)
+get_clean = subprocess.Popen([
+ config, '-c', TEST_CONFIGURATION, '-s', 'PATHS', '-o', 'GNUNET_HOME', '-f'
+],
+ stdout=subprocess.PIPE)
cleandir, x = get_clean.communicate()
cleandir = cleandir.decode("utf-8")
cleandir = cleandir.rstrip('\n').rstrip('\r')
print("Creating an ego " + TEST_REVOCATION_EGO)
sys.stdout.flush()
sys.stderr.flush()
- idc = subprocess.Popen([ident, '-C', TEST_REVOCATION_EGO, '-c', TEST_CONFIGURATION])
+ idc = subprocess.Popen([
+ ident, '-C', TEST_REVOCATION_EGO, '-c', TEST_CONFIGURATION
+ ])
idc.communicate()
if idc.returncode != 0:
- raise Exception("gnunet-identity failed to create an ego `" + TEST_REVOCATION_EGO + "'")
+ raise Exception(
+ "gnunet-identity failed to create an ego `" + TEST_REVOCATION_EGO +
+ "'"
+ )
sys.stdout.flush()
sys.stderr.flush()
print("Testing key " + rev_key)
sys.stdout.flush()
sys.stderr.flush()
- tst = subprocess.Popen([revoc, '-t', rev_key, '-c', TEST_CONFIGURATION], stdout=subprocess.PIPE)
+ tst = subprocess.Popen([revoc, '-t', rev_key, '-c', TEST_CONFIGURATION],
+ stdout=subprocess.PIPE)
output_not_revoked, x = tst.communicate()
output_not_revoked = output_not_revoked.decode("utf-8")
if tst.returncode != 0:
- raise Exception("gnunet-revocation failed to test a key - " + str(tst.returncode) + ": " + output_not_revoked)
+ raise Exception(
+ "gnunet-revocation failed to test a key - " + str(tst.returncode) +
+ ": " + output_not_revoked
+ )
if 'valid' not in output_not_revoked:
res = 1
print("Key was not valid")
print("Revoking key " + rev_key)
sys.stdout.flush()
sys.stderr.flush()
- rev = subprocess.Popen([revoc, '-R', TEST_REVOCATION_EGO, '-p', '-c', TEST_CONFIGURATION])
+ rev = subprocess.Popen([
+ revoc, '-R', TEST_REVOCATION_EGO, '-p', '-c', TEST_CONFIGURATION
+ ])
rev.communicate()
if rev.returncode != 0:
raise Exception("gnunet-revocation failed to revoke a key")
print("Testing revoked key " + rev_key)
sys.stdout.flush()
sys.stderr.flush()
- tst = subprocess.Popen([revoc, '-t', rev_key, '-c', TEST_CONFIGURATION], stdout=subprocess.PIPE)
+ tst = subprocess.Popen([revoc, '-t', rev_key, '-c', TEST_CONFIGURATION],
+ stdout=subprocess.PIPE)
output_revoked, x = tst.communicate()
output_revoked = output_revoked.decode("utf-8")
if tst.returncode != 0: