Make I2P tests not fail for now #10

Merged
PeterSurda merged 3 commits from lee.miller/MiNode:test-i2p into v0.3 2024-08-14 10:05:49 +02:00
Showing only changes of commit a01e2d3469 - Show all commits

View File

@ -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')