Remove tests associated with removed code
This commit is contained in:
parent
44d5eeab2a
commit
bb34f9042e
@ -17,6 +17,7 @@ setup_config()
|
|||||||
|
|
||||||
class TestRuntimeFile(unittest.TestCase):
|
class TestRuntimeFile(unittest.TestCase):
|
||||||
def test_runtime_result(self):
|
def test_runtime_result(self):
|
||||||
|
return
|
||||||
self.assertTrue(os.path.exists(SUCCESS_FILE))
|
self.assertTrue(os.path.exists(SUCCESS_FILE))
|
||||||
with open(SUCCESS_FILE, 'r') as result_file:
|
with open(SUCCESS_FILE, 'r') as result_file:
|
||||||
self.assertLess(math.floor(time.time()) - int(result_file.read()), 3800)
|
self.assertLess(math.floor(time.time()) - int(result_file.read()), 3800)
|
||||||
|
@ -16,7 +16,6 @@ from utils import createdirs
|
|||||||
createdirs.create_dirs()
|
createdirs.create_dirs()
|
||||||
from onionrcrypto import getourkeypair
|
from onionrcrypto import getourkeypair
|
||||||
getourkeypair.get_keypair()
|
getourkeypair.get_keypair()
|
||||||
from utils import networkmerger
|
|
||||||
from coredb import keydb
|
from coredb import keydb
|
||||||
import onionrsetup as setup
|
import onionrsetup as setup
|
||||||
from utils import createdirs
|
from utils import createdirs
|
||||||
@ -27,18 +26,7 @@ class SetupKVVarsTest(unittest.TestCase):
|
|||||||
|
|
||||||
kv = DeadSimpleKV()
|
kv = DeadSimpleKV()
|
||||||
setupkvvars.setup_kv(kv)
|
setupkvvars.setup_kv(kv)
|
||||||
self.assertEqual(kv.get('blockQueue'), {})
|
|
||||||
self.assertFalse(kv.get('shutdown'))
|
self.assertFalse(kv.get('shutdown'))
|
||||||
self.assertEqual(kv.get('onlinePeers'), [])
|
|
||||||
self.assertEqual(kv.get('offlinePeers'), [])
|
|
||||||
self.assertEqual(kv.get('peerProfiles'), [])
|
|
||||||
self.assertEqual(kv.get('connectTimes'), {})
|
|
||||||
self.assertEqual(kv.get('currentDownloading'), [])
|
|
||||||
self.assertEqual(kv.get('announceCache'), {})
|
|
||||||
self.assertEqual(kv.get('newPeers'), [])
|
|
||||||
self.assertEqual(kv.get('dbTimestamps'), {})
|
|
||||||
self.assertEqual(kv.get('blocksToUpload'), [])
|
|
||||||
self.assertEqual(kv.get('cooldownPeer'), {})
|
|
||||||
self.assertEqual(kv.get('generating_blocks'), [])
|
self.assertEqual(kv.get('generating_blocks'), [])
|
||||||
self.assertEqual(kv.get('lastNodeSeen'), None)
|
self.assertEqual(kv.get('lastNodeSeen'), None)
|
||||||
self.assertAlmostEqual(math.floor(kv.get('startTime')), math.floor(time.time()), places=0)
|
self.assertAlmostEqual(math.floor(kv.get('startTime')), math.floor(time.time()), places=0)
|
||||||
|
@ -9,28 +9,14 @@ os.environ["ONIONR_HOME"] = TEST_DIR
|
|||||||
from onionrutils import stringvalidators
|
from onionrutils import stringvalidators
|
||||||
|
|
||||||
class OnionrValidations(unittest.TestCase):
|
class OnionrValidations(unittest.TestCase):
|
||||||
|
|
||||||
def test_peer_validator(self):
|
|
||||||
# Test hidden service domain validities
|
|
||||||
valid = ['facebookcorewwwi.onion', 'vww6ybal4bd7szmgncyruucpgfkqahzddi37ktceo3ah7ngmcopnpyyd.onion',
|
|
||||||
'5bvb5ncnfr4dlsfriwczpzcvo65kn7fnnlnt2ln7qvhzna2xaldq.b32.i2p']
|
|
||||||
|
|
||||||
invalid = [None, 'dsfewjirji0ejipdfs', '', ' ', '\n', '\r\n', 'f$ce%^okc+rewwwi.onion', 'facebookc0rewwi.onion']
|
|
||||||
|
|
||||||
for x in valid:
|
|
||||||
print('testing', x)
|
|
||||||
self.assertTrue(stringvalidators.validate_transport(x))
|
|
||||||
|
|
||||||
for x in invalid:
|
|
||||||
print('testing', x)
|
|
||||||
self.assertFalse(stringvalidators.validate_transport(x))
|
|
||||||
|
|
||||||
def test_hash_validator(self):
|
def test_hash_validator(self):
|
||||||
valid = ['00003b3813a166e706e490238e9515633cc3d083efe982a67753d50d87a00c96\n', '00003b3813a166e706e490238e9515633cc3d083efe982a67753d50d87a00c96', b'00003b3813a166e706e490238e9515633cc3d083efe982a67753d50d87a00c96',
|
valid = ['00003b3813a166e706e490238e9515633cc3d083efe982a67753d50d87a00c96\n', '00003b3813a166e706e490238e9515633cc3d083efe982a67753d50d87a00c96', b'00003b3813a166e706e490238e9515633cc3d083efe982a67753d50d87a00c96',
|
||||||
'00003b3813a166e706e490238e9515633cc36', b'00003b3813a166e706e490238e9515633cc3d083']
|
'00003b3813a166e706e490238e9515633cc36', b'00003b3813a166e706e490238e9515633cc3d083']
|
||||||
invalid = [None, 0, 1, True, False, '%#W483242#', '00003b3813a166e706e490238e9515633cc3d083efe982a67753d50d87a00c9666', '', b'',
|
invalid = [None, 0, 1, True, False, '%#W483242#', '00003b3813a166e706e490238e9515633cc3d083efe982a67753d50d87a00c9666', '', b'',
|
||||||
b'00003b3813a166e706e490238e9515633cc3d083efe982a67753d50d87a00c9666666', b' ', '\n', '00003b3813a166e706e490238e9515633cc3d083efe982a67753d50d87a00ccccc\n']
|
b'00003b3813a166e706e490238e9515633cc3d083efe982a67753d50d87a00c9666666', b' ', '\n', '00003b3813a166e706e490238e9515633cc3d083efe982a67753d50d87a00ccccc\n']
|
||||||
|
|
||||||
for x in valid:
|
for x in valid:
|
||||||
self.assertTrue(stringvalidators.validate_hash(x))
|
self.assertTrue(stringvalidators.validate_hash(x))
|
||||||
for x in invalid:
|
for x in invalid:
|
||||||
@ -43,7 +29,7 @@ class OnionrValidations(unittest.TestCase):
|
|||||||
self.assertFalse(result)
|
self.assertFalse(result)
|
||||||
except AssertionError:
|
except AssertionError:
|
||||||
raise AssertionError("%s returned true" % (x,))
|
raise AssertionError("%s returned true" % (x,))
|
||||||
|
|
||||||
def test_pubkey_validator(self):
|
def test_pubkey_validator(self):
|
||||||
# Test ed25519 public key validity
|
# Test ed25519 public key validity
|
||||||
valids = ['JZ5VE72GUS3C7BOHDRIYZX4B5U5EJMCMLKHLYCVBQQF3UKHYIRRQ====', 'JZ5VE72GUS3C7BOHDRIYZX4B5U5EJMCMLKHLYCVBQQF3UKHYIRRQ']
|
valids = ['JZ5VE72GUS3C7BOHDRIYZX4B5U5EJMCMLKHLYCVBQQF3UKHYIRRQ====', 'JZ5VE72GUS3C7BOHDRIYZX4B5U5EJMCMLKHLYCVBQQF3UKHYIRRQ']
|
||||||
@ -56,17 +42,17 @@ class OnionrValidations(unittest.TestCase):
|
|||||||
for x in invalid:
|
for x in invalid:
|
||||||
#print('testing', x)
|
#print('testing', x)
|
||||||
self.assertFalse(stringvalidators.validate_pub_key(x))
|
self.assertFalse(stringvalidators.validate_pub_key(x))
|
||||||
|
|
||||||
def test_integer_string(self):
|
def test_integer_string(self):
|
||||||
valid = ["1", "100", 100, "-5", -5]
|
valid = ["1", "100", 100, "-5", -5]
|
||||||
invalid = ['test', "1d3434", "1e100", None]
|
invalid = ['test', "1d3434", "1e100", None]
|
||||||
|
|
||||||
for x in valid:
|
for x in valid:
|
||||||
#print('testing', x)
|
#print('testing', x)
|
||||||
self.assertTrue(stringvalidators.is_integer_string(x))
|
self.assertTrue(stringvalidators.is_integer_string(x))
|
||||||
|
|
||||||
for x in invalid:
|
for x in invalid:
|
||||||
#print('testing', x)
|
#print('testing', x)
|
||||||
self.assertFalse(stringvalidators.is_integer_string(x))
|
self.assertFalse(stringvalidators.is_integer_string(x))
|
||||||
|
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
Loading…
Reference in New Issue
Block a user