Add a test for the saved I2P keys
This commit is contained in:
parent
0c898f687b
commit
a01e2d3469
|
@ -10,6 +10,7 @@ import unittest
|
||||||
|
|
||||||
import psutil
|
import psutil
|
||||||
|
|
||||||
|
from minode.i2p import util
|
||||||
from minode.structure import NetAddrNoPrefix
|
from minode.structure import NetAddrNoPrefix
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -158,10 +159,21 @@ class TestProcessI2P(TestProcess):
|
||||||
else:
|
else:
|
||||||
cls.freezed = True
|
cls.freezed = True
|
||||||
|
|
||||||
def test_connections(self):
|
def setUp(self):
|
||||||
"""Ensure all connections are I2P"""
|
"""Fail before any test if I2PController freezed"""
|
||||||
if self.freezed:
|
if self.freezed:
|
||||||
self.fail('I2PController has probably failed to start')
|
self.fail('I2PController has probably failed to start')
|
||||||
|
|
||||||
|
def test_saved_keys(self):
|
||||||
|
"""Check saved i2p keys"""
|
||||||
|
with open(self.keyfile, 'br') as src:
|
||||||
|
i2p_dest_pub = src.read()
|
||||||
|
with open(os.path.join(self.home, 'i2p_dest_priv.key'), 'br') as src:
|
||||||
|
i2p_dest_priv = src.read()
|
||||||
|
self.assertEqual(util.pub_from_priv(i2p_dest_priv), i2p_dest_pub)
|
||||||
|
|
||||||
|
def test_connections(self):
|
||||||
|
"""Ensure all connections are I2P"""
|
||||||
super().test_connections()
|
super().test_connections()
|
||||||
for c in self.connections():
|
for c in self.connections():
|
||||||
self.assertEqual(c.raddr[0], '127.0.0.1')
|
self.assertEqual(c.raddr[0], '127.0.0.1')
|
||||||
|
|
Loading…
Reference in New Issue
Block a user