moved tests to parent directory

master
Kevin Froman 2019-09-12 21:22:25 -05:00
parent ab49e3eaf6
commit 4f6f83f383
No known key found for this signature in database
GPG Key ID: 0D414D0FE405B63B
17 changed files with 31 additions and 18 deletions

2
.gitignore vendored
View File

@ -20,7 +20,7 @@ core
venv/* venv/*
onionr/fs* onionr/fs*
onionr/tmp/* onionr/tmp/*
testdata/*
*.dll *.dll
*.exe *.exe

View File

@ -17,7 +17,7 @@ The following exploits are of particular interest:
* Discovering true server IPs when behind Tor/I2P (aside from Tor/i2p-level attacks) * Discovering true server IPs when behind Tor/I2P (aside from Tor/i2p-level attacks)
* Easily discovering which nodes are the block creator * Easily discovering which nodes are the block creator
* XSS, CSRF, clickjacking, DNS rebinding * XSS, CSRF, clickjacking, DNS rebinding
* Timing attacks against the local http server ([see blog post](https://www.chaoswebs.net/blog/timebleed-breaking-privacy-with-a-simple-timing-attack.html)) * Timing attacks against the local http server that are exploitable from a browser ([see blog post](https://www.chaoswebs.net/blog/timebleed-breaking-privacy-with-a-simple-timing-attack.html))
* Discovering direct connection servers as a non participant. * Discovering direct connection servers as a non participant.
* Cryptography/protocol issues * Cryptography/protocol issues
* Denying nodes access to the network by segmenting them out with Sybil nodes * Denying nodes access to the network by segmenting them out with Sybil nodes

View File

@ -1,5 +1,4 @@
#!/bin/bash #!/bin/bash
cd onionr;
rm -rf testdata; rm -rf testdata;
mkdir testdata; mkdir testdata;
ran=0 ran=0
@ -14,4 +13,4 @@ for f in tests/*.py; do
python3 "$f" || close # if needed python3 "$f" || close # if needed
let "ran++" let "ran++"
done done
echo "ran $ran test files successfully in $SECONDS seconds" echo "ran $ran test files successfully in $SECONDS seconds"

View File

@ -1,6 +1,7 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import sys, os import sys, os
sys.path.append(".") sys.path.append(".")
sys.path.append("onionr/")
import unittest, uuid, hashlib import unittest, uuid, hashlib
import onionrblocks import onionrblocks
@ -30,4 +31,4 @@ class OnionrBlockTests(unittest.TestCase):
bl = onionrblocks.insert(message, asymPeer=onionrcrypto.pub_key) bl = onionrblocks.insert(message, asymPeer=onionrcrypto.pub_key)
self.assertIn(bytesconverter.str_to_bytes(message), onionrblockapi.Block(bl, decrypt=True).bcontent) self.assertIn(bytesconverter.str_to_bytes(message), onionrblockapi.Block(bl, decrypt=True).bcontent)
unittest.main() unittest.main()

View File

@ -1,6 +1,7 @@
from unittest.mock import patch from unittest.mock import patch
import sys, os import sys, os
sys.path.append(".") sys.path.append(".")
sys.path.append("onionr/")
import unittest, uuid import unittest, uuid
TEST_DIR = 'testdata/%s-%s' % (uuid.uuid4(), os.path.basename(__file__)) + '/' TEST_DIR = 'testdata/%s-%s' % (uuid.uuid4(), os.path.basename(__file__)) + '/'
print("Test directory:", TEST_DIR) print("Test directory:", TEST_DIR)
@ -16,4 +17,4 @@ class OnionrTests(unittest.TestCase):
with patch.object(sys, 'argv', testargs): with patch.object(sys, 'argv', testargs):
parser.register() parser.register()
unittest.main() unittest.main()

View File

@ -1,6 +1,7 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import sys, os import sys, os
sys.path.append(".") sys.path.append(".")
sys.path.append("onionr/")
import unittest, uuid, sqlite3 import unittest, uuid, sqlite3
TEST_DIR = 'testdata/%s-%s' % (uuid.uuid4(), os.path.basename(__file__)) + '/' TEST_DIR = 'testdata/%s-%s' % (uuid.uuid4(), os.path.basename(__file__)) + '/'
print("Test directory:", TEST_DIR) print("Test directory:", TEST_DIR)
@ -36,4 +37,4 @@ class OnionrTests(unittest.TestCase):
keydb.transportinfo.set_address_info(adder, 'success', 1000) keydb.transportinfo.set_address_info(adder, 'success', 1000)
self.assertEqual(keydb.transportinfo.get_address_info(adder, 'success'), 1000) self.assertEqual(keydb.transportinfo.get_address_info(adder, 'success'), 1000)
unittest.main() unittest.main()

View File

@ -1,5 +1,6 @@
import sys, os import sys, os
sys.path.append(".") sys.path.append(".")
sys.path.append("onionr/")
import unittest, uuid, json import unittest, uuid, json
TEST_DIR = 'testdata/%s-%s' % (uuid.uuid4(), os.path.basename(__file__)) + '/' TEST_DIR = 'testdata/%s-%s' % (uuid.uuid4(), os.path.basename(__file__)) + '/'
print("Test directory:", TEST_DIR) print("Test directory:", TEST_DIR)
@ -18,4 +19,4 @@ class OnionrConfig(unittest.TestCase):
with open(TEST_DIR + 'config.json') as conf: with open(TEST_DIR + 'config.json') as conf:
json.loads(conf.read()) json.loads(conf.read())
unittest.main() unittest.main()

View File

@ -1,6 +1,7 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import sys, os, random import sys, os, random
sys.path.append(".") sys.path.append(".")
sys.path.append("onionr/")
import unittest, uuid import unittest, uuid
TEST_DIR_1 = 'testdata/%s-%s' % (uuid.uuid4(), os.path.basename(__file__)) + '/' TEST_DIR_1 = 'testdata/%s-%s' % (uuid.uuid4(), os.path.basename(__file__)) + '/'
TEST_DIR_2 = 'testdata/%s-%s' % (uuid.uuid4(), os.path.basename(__file__)) + '/' TEST_DIR_2 = 'testdata/%s-%s' % (uuid.uuid4(), os.path.basename(__file__)) + '/'
@ -40,4 +41,4 @@ class OnionrForwardSecrecyTests(unittest.TestCase):
self.assertEqual(decrypted, message.encode()) self.assertEqual(decrypted, message.encode())
return return
unittest.main() unittest.main()

View File

@ -1,6 +1,7 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import sys, os import sys, os
sys.path.append(".") sys.path.append(".")
sys.path.append("onionr/")
import unittest, uuid import unittest, uuid
TEST_DIR = 'testdata/%s-%s' % (uuid.uuid4(), os.path.basename(__file__)) + '/' TEST_DIR = 'testdata/%s-%s' % (uuid.uuid4(), os.path.basename(__file__)) + '/'
@ -13,4 +14,4 @@ class GetOpenPortTest(unittest.TestCase):
open_port = int(netcontroller.get_open_port()) open_port = int(netcontroller.get_open_port())
self.assertGreaterEqual(open_port, 1024) self.assertGreaterEqual(open_port, 1024)
unittest.main() unittest.main()

View File

@ -1,6 +1,7 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import sys, os import sys, os
sys.path.append(".") sys.path.append(".")
sys.path.append("onionr/")
import unittest, uuid, hashlib, base64 import unittest, uuid, hashlib, base64
import nacl.exceptions import nacl.exceptions
import nacl.signing, nacl.hash, nacl.encoding import nacl.signing, nacl.hash, nacl.encoding
@ -118,4 +119,4 @@ class OnionrCryptoTests(unittest.TestCase):
self.assertTrue(gen1 == gen2) self.assertTrue(gen1 == gen2)
self.assertTrue(stringvalidators.validate_pub_key(gen1[0])) self.assertTrue(stringvalidators.validate_pub_key(gen1[0]))
unittest.main() unittest.main()

View File

@ -1,6 +1,7 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import sys, os import sys, os
sys.path.append(".") sys.path.append(".")
sys.path.append("onionr/")
import unittest, uuid import unittest, uuid
from utils import identifyhome from utils import identifyhome
@ -12,4 +13,4 @@ class IdentifyHomeTest(unittest.TestCase):
os.environ["ONIONR_HOME"] = "testhome" os.environ["ONIONR_HOME"] = "testhome"
self.assertEqual(os.getcwd() + "/testhome/", identifyhome.identify_home()) self.assertEqual(os.getcwd() + "/testhome/", identifyhome.identify_home())
unittest.main() unittest.main()

View File

@ -1,6 +1,7 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import sys, os import sys, os
sys.path.append(".") sys.path.append(".")
sys.path.append("onionr/")
import unittest, uuid import unittest, uuid
TEST_DIR = 'testdata/%s-%s' % (uuid.uuid4(), os.path.basename(__file__)) + '/' TEST_DIR = 'testdata/%s-%s' % (uuid.uuid4(), os.path.basename(__file__)) + '/'
@ -35,4 +36,4 @@ class KeyManagerTest(unittest.TestCase):
with open(filepaths.keys_file, 'r') as keyfile: with open(filepaths.keys_file, 'r') as keyfile:
self.assertNotIn(new_key, keyfile.read()) self.assertNotIn(new_key, keyfile.read())
unittest.main() unittest.main()

View File

@ -1,6 +1,7 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import sys, os import sys, os
sys.path.append(".") sys.path.append(".")
sys.path.append("onionr/")
import unittest, uuid import unittest, uuid
TEST_DIR = 'testdata/%s-%s' % (uuid.uuid4(), os.path.basename(__file__)) + '/' TEST_DIR = 'testdata/%s-%s' % (uuid.uuid4(), os.path.basename(__file__)) + '/'
@ -28,4 +29,4 @@ class NetworkMergerTest(unittest.TestCase):
for adder in adders: for adder in adders:
self.assertNotIn(adder, added) self.assertNotIn(adder, added)
unittest.main() unittest.main()

View File

@ -1,6 +1,7 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import sys, os import sys, os
sys.path.append(".") sys.path.append(".")
sys.path.append("onionr/")
import unittest, uuid import unittest, uuid
import json import json
TEST_DIR = 'testdata/%s-%s' % (uuid.uuid4(), os.path.basename(__file__)) + '/' TEST_DIR = 'testdata/%s-%s' % (uuid.uuid4(), os.path.basename(__file__)) + '/'
@ -89,4 +90,4 @@ class OnionrUserTests(unittest.TestCase):
else: else:
self.assertTrue(False) self.assertTrue(False)
unittest.main() unittest.main()

View File

@ -1,5 +1,6 @@
import sys, os import sys, os
sys.path.append(".") sys.path.append(".")
sys.path.append("onionr/")
import unittest, uuid import unittest, uuid
TEST_DIR = 'testdata/%s-%s' % (uuid.uuid4(), os.path.basename(__file__)) + '/' TEST_DIR = 'testdata/%s-%s' % (uuid.uuid4(), os.path.basename(__file__)) + '/'
@ -44,4 +45,4 @@ class TestStorageCounter(unittest.TestCase):
self.assertEqual(counter.get_amount(), start_value) self.assertEqual(counter.get_amount(), start_value)
unittest.main() unittest.main()

View File

@ -1,6 +1,7 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import sys, os import sys, os
sys.path.append(".") sys.path.append(".")
sys.path.append("onionr/")
import unittest, uuid import unittest, uuid
TEST_DIR = 'testdata/%s-%s' % (uuid.uuid4(), os.path.basename(__file__)) + '/' TEST_DIR = 'testdata/%s-%s' % (uuid.uuid4(), os.path.basename(__file__)) + '/'
print("Test directory:", TEST_DIR) print("Test directory:", TEST_DIR)
@ -68,4 +69,4 @@ class OnionrValidations(unittest.TestCase):
#print('testing', x) #print('testing', x)
self.assertFalse(stringvalidators.is_integer_string(x)) self.assertFalse(stringvalidators.is_integer_string(x))
unittest.main() unittest.main()

View File

@ -1,6 +1,7 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import unittest, sys import unittest, sys
sys.path.append(".") sys.path.append(".")
sys.path.append("onionr/")
from utils import reconstructhash from utils import reconstructhash
@ -18,4 +19,4 @@ class ZFill_Hash(unittest.TestCase):
h = "0000e918d24999ad9b0ff00c1d414f36b74afc93871a0ece4bd452f82b56af87" h = "0000e918d24999ad9b0ff00c1d414f36b74afc93871a0ece4bd452f82b56af87"
h_no = "e918d24999ad9b0ff00c1d414f36b74afc93871a0ece4bd452f82b56af87" h_no = "e918d24999ad9b0ff00c1d414f36b74afc93871a0ece4bd452f82b56af87"
self.assertEqual(reconstructhash.deconstruct_hash(h), h_no) self.assertEqual(reconstructhash.deconstruct_hash(h), h_no)
unittest.main() unittest.main()