diff options
Diffstat (limited to 'src/revocation/test_local_revocation.py.in')
-rw-r--r-- | src/revocation/test_local_revocation.py.in | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/src/revocation/test_local_revocation.py.in b/src/revocation/test_local_revocation.py.in index 4cc6119ca..d73d0a869 100644 --- a/src/revocation/test_local_revocation.py.in +++ b/src/revocation/test_local_revocation.py.in | |||
@@ -11,7 +11,7 @@ | |||
11 | # WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | # WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | # Affero General Public License for more details. | 13 | # Affero General Public License for more details. |
14 | # | 14 | # |
15 | # You should have received a copy of the GNU Affero General Public License | 15 | # You should have received a copy of the GNU Affero General Public License |
16 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | # | 17 | # |
@@ -39,7 +39,10 @@ elif os.name == 'nt': | |||
39 | TEST_CONFIGURATION = "test_revocation.conf" | 39 | TEST_CONFIGURATION = "test_revocation.conf" |
40 | TEST_REVOCATION_EGO = "revoc_test" | 40 | TEST_REVOCATION_EGO = "revoc_test" |
41 | 41 | ||
42 | get_clean = subprocess.Popen([config, '-c', TEST_CONFIGURATION, '-s', 'PATHS', '-o', 'GNUNET_HOME', '-f'], stdout=subprocess.PIPE) | 42 | get_clean = subprocess.Popen([ |
43 | config, '-c', TEST_CONFIGURATION, '-s', 'PATHS', '-o', 'GNUNET_HOME', '-f' | ||
44 | ], | ||
45 | stdout=subprocess.PIPE) | ||
43 | cleandir, x = get_clean.communicate() | 46 | cleandir, x = get_clean.communicate() |
44 | cleandir = cleandir.decode("utf-8") | 47 | cleandir = cleandir.decode("utf-8") |
45 | cleandir = cleandir.rstrip('\n').rstrip('\r') | 48 | cleandir = cleandir.rstrip('\n').rstrip('\r') |
@@ -55,10 +58,15 @@ try: | |||
55 | print("Creating an ego " + TEST_REVOCATION_EGO) | 58 | print("Creating an ego " + TEST_REVOCATION_EGO) |
56 | sys.stdout.flush() | 59 | sys.stdout.flush() |
57 | sys.stderr.flush() | 60 | sys.stderr.flush() |
58 | idc = subprocess.Popen([ident, '-C', TEST_REVOCATION_EGO, '-c', TEST_CONFIGURATION]) | 61 | idc = subprocess.Popen([ |
62 | ident, '-C', TEST_REVOCATION_EGO, '-c', TEST_CONFIGURATION | ||
63 | ]) | ||
59 | idc.communicate() | 64 | idc.communicate() |
60 | if idc.returncode != 0: | 65 | if idc.returncode != 0: |
61 | raise Exception("gnunet-identity failed to create an ego `" + TEST_REVOCATION_EGO + "'") | 66 | raise Exception( |
67 | "gnunet-identity failed to create an ego `" + TEST_REVOCATION_EGO + | ||
68 | "'" | ||
69 | ) | ||
62 | 70 | ||
63 | sys.stdout.flush() | 71 | sys.stdout.flush() |
64 | sys.stderr.flush() | 72 | sys.stderr.flush() |
@@ -72,11 +80,15 @@ try: | |||
72 | print("Testing key " + rev_key) | 80 | print("Testing key " + rev_key) |
73 | sys.stdout.flush() | 81 | sys.stdout.flush() |
74 | sys.stderr.flush() | 82 | sys.stderr.flush() |
75 | tst = subprocess.Popen([revoc, '-t', rev_key, '-c', TEST_CONFIGURATION], stdout=subprocess.PIPE) | 83 | tst = subprocess.Popen([revoc, '-t', rev_key, '-c', TEST_CONFIGURATION], |
84 | stdout=subprocess.PIPE) | ||
76 | output_not_revoked, x = tst.communicate() | 85 | output_not_revoked, x = tst.communicate() |
77 | output_not_revoked = output_not_revoked.decode("utf-8") | 86 | output_not_revoked = output_not_revoked.decode("utf-8") |
78 | if tst.returncode != 0: | 87 | if tst.returncode != 0: |
79 | raise Exception("gnunet-revocation failed to test a key - " + str(tst.returncode) + ": " + output_not_revoked) | 88 | raise Exception( |
89 | "gnunet-revocation failed to test a key - " + str(tst.returncode) + | ||
90 | ": " + output_not_revoked | ||
91 | ) | ||
80 | if 'valid' not in output_not_revoked: | 92 | if 'valid' not in output_not_revoked: |
81 | res = 1 | 93 | res = 1 |
82 | print("Key was not valid") | 94 | print("Key was not valid") |
@@ -86,7 +98,9 @@ try: | |||
86 | print("Revoking key " + rev_key) | 98 | print("Revoking key " + rev_key) |
87 | sys.stdout.flush() | 99 | sys.stdout.flush() |
88 | sys.stderr.flush() | 100 | sys.stderr.flush() |
89 | rev = subprocess.Popen([revoc, '-R', TEST_REVOCATION_EGO, '-p', '-c', TEST_CONFIGURATION]) | 101 | rev = subprocess.Popen([ |
102 | revoc, '-R', TEST_REVOCATION_EGO, '-p', '-c', TEST_CONFIGURATION | ||
103 | ]) | ||
90 | rev.communicate() | 104 | rev.communicate() |
91 | if rev.returncode != 0: | 105 | if rev.returncode != 0: |
92 | raise Exception("gnunet-revocation failed to revoke a key") | 106 | raise Exception("gnunet-revocation failed to revoke a key") |
@@ -94,7 +108,8 @@ try: | |||
94 | print("Testing revoked key " + rev_key) | 108 | print("Testing revoked key " + rev_key) |
95 | sys.stdout.flush() | 109 | sys.stdout.flush() |
96 | sys.stderr.flush() | 110 | sys.stderr.flush() |
97 | tst = subprocess.Popen([revoc, '-t', rev_key, '-c', TEST_CONFIGURATION], stdout=subprocess.PIPE) | 111 | tst = subprocess.Popen([revoc, '-t', rev_key, '-c', TEST_CONFIGURATION], |
112 | stdout=subprocess.PIPE) | ||
98 | output_revoked, x = tst.communicate() | 113 | output_revoked, x = tst.communicate() |
99 | output_revoked = output_revoked.decode("utf-8") | 114 | output_revoked = output_revoked.decode("utf-8") |
100 | if tst.returncode != 0: | 115 | if tst.returncode != 0: |